from urllib.request import urlopen
def get_ip(self):
try:
return str(urlopen('http://159.75.41.235/').read())
except:
return False
print(get_ip())
Access to external network IP speed mainly depends on the server speed, this domestic than foreign those much faster
Return the sample
{"city_id":2140,"region":"China|0|Guangdong|Guangzhou|Guangdong Radio and Television","ip":"124.240.53.227"}