1import re
2import json
3from urllib2 import urlopen
4
5url = 'http://ipinfo.io/json'
6response = urlopen(url)
7data = json.load(response)
8
9IP=data['ip']
10org=data['org']
11city = data['city']
12country=data['country']
13region=data['region']
14
15print 'Your IP detail\n '
16print 'IP : {4} \nRegion : {1} \nCountry : {2} \nCity : {3} \nOrg : {0}'.format(org,region,country,city,IP)
17