Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb541c3 commit 0f854d8Copy full SHA for 0f854d8
sendIP.py
@@ -0,0 +1,24 @@
1
+#!/usr/bin/env python3
2
+# Copyright (c) 2022. 楊鵬. All Rights Reserved.
3
+import socket
4
+
5
+import requests
6
7
+URL = "https://notify-api.line.me/api/notify"
8
+TOKEN = "mCfw9Yzf8MsXuW2caAPYOkNl7nSewwYppdmV97VRWn6"
9
10
11
+def sendIP(ip: str):
12
+ headers = {"Authorization": "Bearer " + TOKEN}
13
+ params = {"message": ip}
14
+ r = requests.post(URL, headers=headers, params=params)
15
+ print(r.text)
16
17
18
+if __name__ == "__main__":
19
+ connect_interface = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
20
+ connect_interface.connect(("8.8.8.8", 80))
21
+ ip_addr = connect_interface.getsockname()[0]
22
+ connect_interface.close()
23
+ message = f"IP Address: {ip_addr}"
24
+ sendIP(message)
0 commit comments