Created
November 13, 2016 02:20
-
-
Save picatz/65b1508e0c27ff256b5fb9a484e65e41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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