--- id: geoip2 version: "5.3.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # geoip2 — MaxMind GeoIP API License: permissive · Maintenance: active · Downloads: 18.0M/mo ## 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 above — verify before relying. Queries MaxMind's GeoIP web services and databases to look up geographic and network information for IP addresses, returning country, city, subdivision, postal, and location data. 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 pip install geoip2 uv add geoip2 poetry add geoip2 ## Installing geoip2 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). 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' 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. 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_current - Install friction: low - Maintenance: active - Downloads: 18.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags ip geolocation lookup, geoip database reader, maxmind api client, ip to city country, geographic ip address, geolite web service, ip location data, geolocation, ip-lookup, maxmind [View on SkillFed](https://skillfed.io/packages/geoip2) · [View on PyPI](https://pypi.org/project/geoip2/)