Skip to content

Instantly share code, notes, and snippets.

@picatz
Created November 13, 2016 02:20
Show Gist options
  • Save picatz/65b1508e0c27ff256b5fb9a484e65e41 to your computer and use it in GitHub Desktop.
Save picatz/65b1508e0c27ff256b5fb9a484e65e41 to your computer and use it in GitHub Desktop.
from ipdb import set_trace
import sys
import requests
import json
# set a breakpoint
set_trace()
# ip address is passed in as the first argument
ip = sys.argv[1]
# make a request to ipinfo.io containing the ip address
site_data = requests.get('http://ipinfo.io/' + ip).content
# parse the site data
json_data = json.loads(site_data)
# iterate and print the json data
for label, info in json_data.iteritems():
print label + ': ' + info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment