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 detail\n ')
print("""IP : {4} 
Region : {1} 
Country : {2} 
City : {3} 
Org : {0}""".format(
    org, reg, ctry, city, IP))
How to find location with ip address in python?