Skip to main content

Convert IP addresses to countries using delegated registry data

Project description

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', 'country_name': 'United States'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ip_to_country-0.1.2.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ip_to_country-0.1.2-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file ip_to_country-0.1.2.tar.gz.

File metadata

  • Download URL: ip_to_country-0.1.2.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ip_to_country-0.1.2.tar.gz
Algorithm Hash digest
SHA256 94474a2763641fdb7cd03a4de5cd36068d4892b37a953b08f882a01cbf18b66a
MD5 a38b0ad18c7be677d1841daae3aa8dff
BLAKE2b-256 ad07f75ff3e6029f3970b4febc2e2fff9cab4fd0677a00ca938522e1a02d579c

See more details on using hashes here.

File details

Details for the file ip_to_country-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ip_to_country-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ip_to_country-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f1fee574aa1cb5e4f07eb2367b8a5fbde966e436e043fcbe58adb81b1b688fc3
MD5 6110f57202be9ca3deb89671b1754922
BLAKE2b-256 237e54ff9f67b6214c5395d81bc29162e778ea2cc3498c20337701265883b98a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page