Created
July 1, 2018 11:51
-
-
Save kupp1/3278e7f69d7d4e357586397dcf000dea to your computer and use it in GitHub Desktop.
ipstack api usage on python3
This file contains 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
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
#ipstack replace freegeoip :"(( | |
import urllib.request | |
import json | |
token = '' #get token on ipstack.com | |
def get_info(adress: str): | |
api = 'http://api.ipstack.com/' + adress + '?access_key=' + token + '&format=1' | |
result = urllib.request.urlopen(api).read() | |
result = result.decode() | |
result = json.loads(result) | |
return result #return dict |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment