a
This commit is contained in:
parent
54e78333dd
commit
7ba3bdcda1
9 changed files with 40 additions and 39 deletions
0
utils/__init__.py
Normal file
0
utils/__init__.py
Normal file
11
utils/network.py
Normal file
11
utils/network.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import socket
|
||||
|
||||
def get_ip():
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
s.connect(("8.8.8.8", 80))
|
||||
ip = s.getsockname()[0]
|
||||
s.close()
|
||||
return ip
|
||||
except Exception:
|
||||
return "No IP"
|
||||
Loading…
Add table
Add a link
Reference in a new issue