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 detail
'
print 'IP : {4}
Region : {1}
Country : {2}
City : {3}
Org : {0}'.format(org,region,country,city,IP)