mynode/rootfs/standard/usr/bin/get_local_ip.py

9 lines
157 B
Python
Raw Normal View History

2021-11-22 03:01:09 +00:00
#!/usr/local/bin/python3
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
print(s.getsockname()[0])
s.close()