geoip2
MaxMind GeoIP API
Decision gist · record as of 2026-08-14
Yes. geoip2 is the official, actively maintained client for MaxMind's geolocation services, with low install friction, permissive licensing, no known vulnerabilities, and broad Python version support. Install it if you need to look up IP geolocation data; it is the standard choice for this task. Verify you have a MaxMind account and license key (or a local database file) before relying on it in production.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a MaxMind account ID and license key for web service use, or a local GeoIP/GeoLite database file for database reader mode.
- Optional C extension for database reader requires libmaxminddb system library.
- Low install friction; pure Python wheel with three runtime dependencies (aiohttp, maxminddb, requests).
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive). You may use, modify, and distribute this package freely in commercial or private projects, provided you include a copy of the license and state any material changes.
last release 2026-07-16 (29 days) · last repo commit 2026-08-10 · 1,216 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 18,029,953 downloads/mo, #1,089 on PyPI
Alternatives
Verify before relying
import geoip2.webservice
with geoip2.webservice.Client(account_id, 'license_key') as client:
response = client.city('203.0.113.0')
print(response.country.iso_code) # 'US'
print(response.city.name) # 'Minneapolis'- Whether the C extension for database reader significantly improves performance over pure Python mode.
- Accuracy and freshness guarantees for GeoIP data returned by the web service or databases.
What it is and what it does
geoip2 is the official Python client library for MaxMind's GeoIP and GeoLite services. It provides both synchronous and asynchronous interfaces to query IP geolocation data from MaxMind's web services or from local MaxMind database files. The library handles authentication, request formatting, error handling, and response parsing, returning structured objects with country codes, city names, subdivisions, postal codes, latitude/longitude, and network information.
The package is designed for developers who need to determine the geographic location or network details of an IP address in their application. It supports both real-time web service queries (with optional Sandbox or GeoLite endpoints) and offline database lookups using local .mmdb files. The library abstracts away HTTP communication (via requests or aiohttp) and binary database parsing (via maxminddb), making it straightforward to integrate IP geolocation into web services, analytics pipelines, or security workflows.
Use it for
- Determine user location for content localization or regional compliance in web applications.
- Detect suspicious login attempts by comparing user IP location against historical patterns.
- Analyze traffic sources and geographic distribution of website visitors.
- Implement geo-blocking or geo-routing logic based on IP address origin.
- Enrich server logs or analytics data with geographic and network metadata.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
geoip2 is the official, actively maintained client for MaxMind's geolocation services, with low install friction, permissive licensing, no known vulnerabilities, and broad Python version support. Install it if you need to look up IP geolocation data; it is the standard choice for this task. Verify you have a MaxMind account and license key (or a local database file) before relying on it in production.
Install
geoip2 on PyPI
Before you install
Low install friction; pure Python wheel with three runtime dependencies (aiohttp, maxminddb, requests). Actively maintained with a release 29 days ago and last commit on 2026-08-10. Supports modern Python versions (3.10–3.14).
Requires a MaxMind account ID and license key for web service use, or a local GeoIP/GeoLite database file for database reader mode. Optional C extension for database reader requires libmaxminddb system library.
License in practice
Licensed under Apache-2.0 (permissive). You may use, modify, and distribute this package freely in commercial or private projects, provided you include a copy of the license and state any material changes.
Quickstart
import geoip2.webservice
with geoip2.webservice.Client(account_id, 'license_key') as client:
response = client.city('203.0.113.0')
print(response.country.iso_code) # 'US'
print(response.city.name) # 'Minneapolis'
Verify before relying
- Whether the C extension for database reader significantly improves performance over pure Python mode.
- Accuracy and freshness guarantees for GeoIP data returned by the web service or databases.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesaiohttpmaxminddbrequests |
| Maintenance | Actively maintained 29 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 18,029,953 / month, #1,089 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersIntended Audience :: System AdministratorsProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: InternetTopic :: Internet :: Proxy Servers |
Evidence: geoip2-5.3.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “geoip database reader”
- geoip2Queries MaxMind's GeoIP web services and databases to look up…
- maxminddb-geolite2Provides geolocation lookups by IP address using MaxMind's GeoLite2…
- geoip2fastGeoIP2Fast performs fast geolocation lookups for IPv4 and IPv6…
Give your agent the search over MCP, or paste the wish link into any chat.
More Internet packages
Botocore provides low-level, data-driven access to Amazon Web Services APIs, serving as the foundation for the AWS CLI and boto3 libraries.
Install it if you need programmatic access to AWS services.
Provides an async client for AWS services using botocore and aiohttp, allowing you to call AWS APIs asynchronously within asyncio-based applications.
Install it if you need to call AWS services from async Python code; it is the standard way to do so.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides a platform-independent file locking mechanism to coordinate access to files across processes and threads.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides common Protocol Buffer message definitions used across Google Cloud APIs, enabling Python clients to interact with Google services.
See also maxminddb-geolite2 · minfraud · geoip2fast · geoip2-tools · maxminddb · mmdb-writer · IP2Location · ip3country · ipinfo