From c2e8eb5e25c9bb2933c0c08cd004e602861b3444 Mon Sep 17 00:00:00 2001 From: SudoLite <72527182+SudoLite@users.noreply.github.com> Date: Sun, 17 Apr 2022 03:38:48 +0430 Subject: [PATCH] Update start.py --- start.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/start.py b/start.py index 6f0619979..0fc17415c 100644 --- a/start.py +++ b/start.py @@ -54,23 +54,9 @@ with open(__dir__ / "config.json") as f: con = load(f) -def getMyIPAddress(): - global __ip__ - if __ip__: - return __ip__ - with suppress(Exception): - return get('https://api.my-ip.io/ip', timeout=.1).text - with suppress(Exception): - return get('https://ipwhois.app/json/', timeout=.1).json()["ip"] - with suppress(Exception): - return get('https://ipinfo.io/json', timeout=.1).json()["ip"] - with suppress(Exception): - return ProxyTools.Patterns.IP.search(get('http://checkip.dyndns.org/', timeout=.1).text) - with suppress(Exception): - return ProxyTools.Patterns.IP.search(get('https://spaceiran.com/myip/', timeout=.1).text) - with suppress(Exception): - return get('https://ip.42.pl/raw', timeout=.1).text - return getMyIPAddress() +with socket(AF_INET, SOCK_DGRAM) as s: + s.connect(("8.8.8.8", 80)) + __ip__ = s.getsockname()[0] class bcolors: