geoip2-tools provides command-line utilities for the automatic update and administration of MaxMind GeoIP2 databases. It simplifies the process of downloading and managing the GeoLite2 or GeoIP2 databases. The current version is 0.1.1, and the project appears to be in a stable state with a slow release cadence, primarily focusing on bug fixes.
pip install geoip2-toolsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure your MaxMind credentials via environment variables and then use the `geoip2-tools` CLI to update and check the status of your GeoIP2 databases. Ensure you replace the placeholder credentials with your own.
Use `pip install geoip2` and `from geoip2.database import Reader` for in-application lookups.
Before running `geoip2-tools update`, set environment variables: `export GEOIP2_ACCOUNT_ID='...'` and `export GEOIP2_LICENSE_KEY='...'`. Alternatively, configure them in a `geoip2-tools.yaml` file.
Use the `--database-path` option with CLI commands or configure the `database_path` in `geoip2-tools.yaml` to specify a desired storage location.