Answers for "find city by ip address python"

0

python get city name from IP

import re
import json
from urllib2 import urlopen

url = 'http://ipinfo.io/json'
response = urlopen(url)
data = json.load(response)

IP=data['ip']
org=data['org']
city = data['city']
country=data['country']
region=data['region']

print 'Your IP detailn '
print 'IP : {4} nRegion : {1} nCountry : {2} nCity : {3} nOrg : {0}'.format(org,region,country,city,IP)
Posted by: Guest on January-20-2021

Python Answers by Framework

Browse Popular Code Answers by Language