How to use the Ipinfo.io authentication token on jupyter notebook?

Viewed 28

I am trying to use geocoder on large stack (~1400) of IP's on jupyters notebook (running on browser as I dont have pycharm professional), after a while i got the "429 Client Error: Too Many Requests for url:".

Looking into the ipinfo.io site and they have user authentication tokens that would allow 50k requests, issue is, i have not been able to find out how and where to use it.

the site documentation states using it with another "gethandler" method but i want to use it on the geocoder module, after googling where its done, few resources state to open the JN using pycharm but that too has been a fail even after importing the "jupyter" interpreter.

On the other hand ive not been able to locate the terminal of JN (running on browser).

if anyone knows how and where to apply this token, help would be much appreciated.

1 Answers

Looking into the ipinfo.io site and they have user authentication tokens that would allow 50k requests, issue is, i have not been able to find out how and where to use it.

You need to sign up and create an account on IPinfo.io to get the access token to use it in your project.

  1. Sign up for a free account at IPinfo.io. The free account provides upto 50,000 requests/month.
  2. Go to your account dashboard after you have signed up.
  3. Scroll all way to the bottom. Then you can copy your access_token from there. enter image description here

the site documentation states using it with another "gethandler" method but i want to use it on the geocoder module...

Read through IPinfo's Python module documentation or this simple starter guide: IP Address Geolocation data with Python in under 30 Seconds.

You need to install the IPinfo module with the command pip install ipinfo on your terminal. Then you can use the import ipinfo statement to import the module in Jupyter Notebook. This a code snippet from the documentation:

>>> import ipinfo
>>> access_token = '123456789abc'
>>> handler = ipinfo.getHandler(access_token)
>>> ip_address = '216.239.36.21'
>>> details = handler.getDetails(ip_address)
>>> details.city
'Mountain View'
>>> details.loc
'37.3861,-122.0840'

The IPinfo module will provide you with IP geolocation data from IP addresses. You can use it in combination of geocode.

Related