{"id":7257,"library":"geoip2-tools","title":"geoip2-tools","description":"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.","status":"active","version":"0.1.1","language":"en","source_language":"en","source_url":"https://github.com/Nekmo/geoip2-tools/","tags":["MaxMind","GeoIP","CLI","database management","geolocation"],"install":[{"cmd":"pip install geoip2-tools","lang":"bash","label":"Install geoip2-tools"}],"dependencies":[{"reason":"Required for interacting with MaxMind GeoIP2 data formats and underlying API logic.","package":"geoip2"},{"reason":"Used for building the command-line interface (CLI).","package":"click"},{"reason":"Used for making HTTP requests to download GeoIP2 database updates from MaxMind.","package":"requests"}],"imports":[{"note":"While `geoip2-tools` is primarily a CLI tool, the `Manager` class can be imported for programmatic control over database updates and administration tasks within custom Python scripts.","symbol":"Manager","correct":"from geoip2_tools.manager import Manager"}],"quickstart":{"code":"# 1. Set your MaxMind account ID and license key as environment variables\n#    (Replace 'YOUR_ACCOUNT_ID' and 'YOUR_LICENSE_KEY' with your actual credentials)\nexport GEOIP2_ACCOUNT_ID=\"YOUR_ACCOUNT_ID\"\nexport GEOIP2_LICENSE_KEY=\"YOUR_LICENSE_KEY\"\n\n# 2. Run the update command to download/update databases\ngeoip2-tools update\n\n# 3. Check the status of your databases\ngeoip2-tools status","lang":"bash","description":"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."},"warnings":[{"fix":"Use `pip install geoip2` and `from geoip2.database import Reader` for in-application lookups.","message":"This library is designed for *managing* GeoIP2 databases (downloading, updating). It is not for performing GeoIP lookups within Python code. For that, you should use the `geoip2` library directly (e.g., `from geoip2.database import Reader`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"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.","message":"To download or update GeoIP2 databases, you *must* provide your MaxMind Account ID and License Key. These can be set via `GEOIP2_ACCOUNT_ID` and `GEOIP2_LICENSE_KEY` environment variables, or through a configuration file.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use the `--database-path` option with CLI commands or configure the `database_path` in `geoip2-tools.yaml` to specify a desired storage location.","message":"The default database download location might not be suitable for your production environment. Databases are typically stored in `/usr/local/share/GeoIP` (Linux) or a user's data directory. Consider configuring a custom path if needed.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Ensure the package is installed: `pip install geoip2-tools`. If installed in a virtual environment, ensure the environment is activated. If installed globally, verify your PATH.","cause":"The `geoip2-tools` package is not installed or the executable is not in your system's PATH.","error":"Command 'geoip2-tools' not found"},{"fix":"Set your MaxMind Account ID and License Key as environment variables: `export GEOIP2_ACCOUNT_ID=\"YOUR_ACCOUNT_ID\"` and `export GEOIP2_LICENSE_KEY=\"YOUR_LICENSE_KEY\"`. Replace placeholders with your actual credentials. Alternatively, configure them in a `geoip2-tools.yaml` file.","cause":"The MaxMind credentials required for downloading database updates are missing.","error":"Neither GEOIP2_ACCOUNT_ID nor GEOIP2_LICENSE_KEY were provided."},{"fix":"Double-check your `GEOIP2_ACCOUNT_ID` and `GEOIP2_LICENSE_KEY` values for correctness. Verify them on your MaxMind account page. Ensure your license key is still active.","cause":"Your MaxMind Account ID or License Key are incorrect or have expired, leading to an authentication failure when trying to download databases.","error":"requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: ..."}]}