ip-to-country
ip-to-country is a blazing-fast, offline Python library that determines the country for any given IP address (IPv4 or IPv6) using pre-parsed regional internet registry data.
No internet access or third-party APIs required: everything runs locally and instantly.
⚡ Features
- 🌍 Offline IP Geolocation – no network calls or external services
- ⚡ Super Fast Lookup – optimized with binary search for IPv4
- ✅ Supports IPv4 and IPv6
- 📦 Uses Official RIR Data – from AFRINIC, RIPE, ARIN, APNIC, and LACNIC
- 🌐 Country Code + Name Output – based on ISO 3166
- 🕵️ Supports special codes like
A1(Anonymous Proxy),A2,O1, etc.
📦 Installation
pip install ip-to-country
🛠️ Usage
from ip_to_country import IpToCountry
ip_lookup = IpToCountry()
country_info = ip_lookup.ip_to_country("8.8.8.8")
print(country_info)
# Output: {'country_code': 'US', 'ISO3166-1-Alpha-3': 'USA', 'region': 'Americas', 'continent': 'NA', 'languages': ['en-US', 'es-US', 'haw', 'fr'], 'country_name': 'United States of America', 'currency': 'US Dollar', 'currency_code': 'USD'}
Metadata
Release files for ip-to-country 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ip_to_country-1.0.2.tar.gz | 1.5 MB | Without provenance | Details for ip_to_country-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ip_to_country-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for ip_to_country-1.0.2-py3-none-any.whl |
Total release size: 3.0 MB
Release files / ip_to_country-1.0.2.tar.gz
| Download URL | ip_to_country-1.0.2.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98d99ce338958583506b7b446c64f47a98acfe0c9fcdf419cd7429a8c5213b4b
|
|
BLAKE2b-256 checksum How to use checksums |
f2881328ec54e0012707cd25c66147bb9435e0479dce9c8dff4f3fa25147dd64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / ip_to_country-1.0.2-py3-none-any.whl
| Download URL | ip_to_country-1.0.2-py3-none-any.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9ed48466bab9037ef86b20107c4770dc3f5893591c9684a4b252bbdb0629f0f
|
|
BLAKE2b-256 checksum How to use checksums |
9ee4441857e7ea34f7cffde3ebe82f1d0ca55cea67366493853b9d26d4b48e95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for ip-to-country 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.