Skip to content

Instantly share code, notes, and snippets.

@rchardptrsn
Created November 22, 2020 03:50
Show Gist options
  • Save rchardptrsn/eee0cb844dfa16ec521f55f112d35323 to your computer and use it in GitHub Desktop.
Save rchardptrsn/eee0cb844dfa16ec521f55f112d35323 to your computer and use it in GitHub Desktop.
import ipinfo
def ipData(address):
# https://stackoverflow.com/questions/24678308/how-to-find-location-with-ip-address-in-python
ip_address = address[0]
# ipinfo package - free up to 50k requests
# https://github.com/ipinfo/python
# login to ipinfo account: https://ipinfo.io/account?welcome=true
access_token = '<your-access-token'
# initialize handler with access token
handler = ipinfo.getHandler(access_token)
# create details object from handler search of the ip address
details = handler.getDetails(ip_address)
return details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment