networking revert
@@ -102,27 +102,27 @@ def get_external_ip() -> str:
except Exception:
pass
- # --- Try myip.dnsomatic
+ # --- Try ipify
try:
- process = os.popen('curl -s myip.dnsomatic.com')
- external_ip = process.readline()
- process.close()
+ external_ip = requests.get('https://api.ipify.org').text
assert isinstance(ip_to_int(external_ip), int)
return str(external_ip)
except Exception:
pass
- # --- Try ipify
+ # --- Try AWS
try:
- external_ip = requests.get('https://api.ipify.org').text
+ external_ip = requests.get('https://checkip.amazonaws.com').text.strip()
assert isinstance(ip_to_int(external_ip), int)
return str(external_ip)
except Exception:
pass
- # --- Try AWS
+ # --- Try myip.dnsomatic
try:
- external_ip = requests.get('https://checkip.amazonaws.com').text.strip()
+ process = os.popen('curl -s myip.dnsomatic.com')
+ external_ip = process.readline()
+ process.close()
assert isinstance(ip_to_int(external_ip), int)
return str(external_ip)
except Exception:
