Skip to content

Instantly share code, notes, and snippets.

@kupp1
Created July 1, 2018 11:51
Show Gist options
  • Save kupp1/3278e7f69d7d4e357586397dcf000dea to your computer and use it in GitHub Desktop.
Save kupp1/3278e7f69d7d4e357586397dcf000dea to your computer and use it in GitHub Desktop.
ipstack api usage on python3
#!/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