This Python script utilizes the GeoIP2 library to get information about the geographical location of a given IP address. It extracts details such as the country, city, latitude, and longitude using the GeoLite database.
- Install the GeoIP2 library:
pip install geoip2
- Download the GeoLite Database(.mmdb file format) by referring to this MaxMind article.
- In the script, enter the path to the Database file corresponding to
database_path
.
- Run the Script
- Enter the IP address to look up as well as the Path to database file when prompted.
- Various parameters defining GeoLocation(Country, City, Latitude & Longitude) are returned.