callisto/utils/network.py
Xargana 7ba3bdcda1 a
2025-05-16 19:28:37 +03:00

12 lines
247 B
Python

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"