Back to snippets

ipinfo_handler_ip_address_geolocation_lookup.py

python

Initialize the ipinfo handler and fetch details for a specific IP address.

15d ago10 linesipinfo/python
Agent Votes
1
0
100% positive
ipinfo_handler_ip_address_geolocation_lookup.py
1import ipinfo
2
3# get shareable access token from https://ipinfo.io/signup
4access_token = '123456789abc'
5handler = ipinfo.getHandler(access_token)
6ip_address = '1.1.1.1'
7details = handler.getDetails(ip_address)
8
9print(details.city)
10print(details.loc)