Created
November 22, 2020 03:50
-
-
Save rchardptrsn/eee0cb844dfa16ec521f55f112d35323 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
| 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