matts0613

IP Geolocation Script.py

Mar 28th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. import re
  2. import json
  3. from urllib2 import urlopen
  4.  
  5. url = 'http://ipinfo.io/json'
  6. response = urlopen(url)
  7. data = json.load(response)
  8.  
  9. IP=data['ip']
  10. org=data['org']
  11. city = data['city']
  12. country=data['country']
  13. region=data['region']
  14.  
  15. print 'Your IP detail\n '
  16. print 'IP : {4} \nRegion : {1} \nCountry : {2} \nCity : {3} \nOrg : {0}'.format(org,region,country,city,IP)
Add Comment
Please, Sign In to add comment