--- id: ip2location version: "8.11.0" license: unclear license_treatment: permissive maintenance: aging --- # IP2Location — This is an IP geolocation library that enables the user to find the country, region, city, latitude and longitude, ZIP code, time zone, ISP, domain name, area code, weather info, mobile info, elevation, usage type, address type and IAB category from an IP address. It supports both IPv4 and IPv6 lookup. License: permissive · Maintenance: aging · Downloads: 394.8K/mo ## What it is and what it does IP2Location is a Python library for IP geolocation lookups that reads from binary database files to return detailed location and network information for both IPv4 and IPv6 addresses. It extracts country, region, city, coordinates, ISP, timezone, domain, area code, weather station data, mobile carrier codes, elevation, usage type, and IAB category from a single IP query. The library has no runtime dependencies and supports Python 3.5 through 3.13 on CPython and PyPy. To use it, you download a BIN database file from IP2Location (free LITE or commercial versions), then instantiate the library with that file path and call query methods. It's a straightforward wrapper around binary database lookups, so the main constraint is obtaining and maintaining the database file separately. Use it for: - Geoblock content or services by country or region based on user IP addresses. - Enrich user analytics with location, ISP, and network type information. - Detect and flag suspicious login attempts from unexpected geographic regions. - Route requests to regional servers or CDN nodes based on client IP location. - Populate user profiles with inferred timezone and language preferences from IP. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Looks up geolocation data (country, region, city, latitude/longitude, ISP, timezone, and more) from an IP address or hostname by querying an IP2Location BIN database file. Yes, if you need IP geolocation and are willing to manage a separate BIN database file. The library is stable, has no dependencies, and covers a broad range of lookup fields. The main trade-off is that you must download and maintain the database yourself; it's not a live API service. Maintenance is aging but the repository remains active and there are no known vulnerabilities. ## Install pip install ip2location uv add ip2location poetry add ip2location ## Installing IP2Location Before you install: Installs with no runtime dependencies and low friction. Last release was 344 days ago; the repository is active and not archived, though maintenance appears to be slowing. License in practice: Licensed under MIT (permissive), so you can use, modify, and distribute the library freely in commercial and private projects with minimal restrictions. Quickstart: pip install ip2location import ip2location db = ip2location.IP2Location() db.open('path/to/IP2LOCATION-LITE-DB5.BIN') result = db.query_by_ip_address('8.8.8.8') You must download an IP2Location BIN database file separately (free LITE versions available at lite.ip2location.com or commercial versions at ip2location.com) before queries will work. Verify before relying: - Whether the library actively maintains compatibility with Python versions beyond 3.13. - Performance characteristics when querying very large numbers of addresses. - Whether BIN database updates are automatic or require manual download and replacement. ## Package facts - License: not declared (permissive) - Python support: unspecified - Install friction: low - Maintenance: aging - Downloads: 394.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags ip geolocation lookup, ip address to location, find city from ip, ipv4 ipv6 geolocation, ip to country region city, geoip database query, ip location database, geolocation, ip-lookup, offline-database [View on SkillFed](https://skillfed.io/packages/ip2location) · [View on PyPI](https://pypi.org/project/ip2location/)