Fast, offline IP-to-country lookup. Python bindings over the Rust iptocc crate.
Project description
iptocc
Fast, offline IPv4/IPv6 to ISO 3166-1 alpha-2 country code lookup for Python.
[!IMPORTANT] iptocc 3.0 is a complete Rust rewrite. Versions 2.x and earlier were pure-Python on top of pandas. The public API stays mostly compatible (see migration notes below) but is roughly 65,000x faster on bulk workloads and adds a batch API. IPv6 is still supported.
Features
- Offline lookup, no API keys, no network calls
- IPv4 and IPv6 in one call
- Single string OR batch (any iterable of strings)
- Lookup data embedded in the wheel; no runtime file I/O
iptoccCLI installed alongside the library- Database refreshed nightly from the five Regional Internet Registries
Install
Requires Python 3.10 or newer.
pip install iptocc
Usage
from iptocc import country_code
country_code("8.8.8.8") # "US"
country_code(["8.8.8.8", "1.0.16.1"]) # ["US", "JP"]
A CLI is installed alongside the library:
$ iptocc 8.8.8.8 1.0.16.1
8.8.8.8 US
1.0.16.1 JP
Migrating from 2.x
# 2.x
from iptocc import get_country_code, CountryCodeNotFound
try:
cc = get_country_code("8.8.8.8")
except CountryCodeNotFound:
cc = None
# 3.x
from iptocc import country_code
cc = country_code("8.8.8.8") # returns None on miss
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iptocc-3.0.0a1.tar.gz.
File metadata
- Download URL: iptocc-3.0.0a1.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef2af641ee06f83deaf65bad82e4e8625e27e935bee474cc02e9c978bae15970
|
|
| MD5 |
6b0bd82dd9b88127a5d2a4f56e934b81
|
|
| BLAKE2b-256 |
af0fba97b7a84d2e9b45f6944a1720708a946fe63cea9beb540f6304b6444b0f
|
Provenance
The following attestation bundles were made for iptocc-3.0.0a1.tar.gz:
Publisher:
publish-pypi.yml on roniemartinez/IPToCC
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iptocc-3.0.0a1.tar.gz -
Subject digest:
ef2af641ee06f83deaf65bad82e4e8625e27e935bee474cc02e9c978bae15970 - Sigstore transparency entry: 1333369974
- Sigstore integration time:
-
Permalink:
roniemartinez/IPToCC@48d5ab664c3c41bb3edf5c2729cad062a9d0683a -
Branch / Tag:
refs/tags/python-v3.0.0-alpha.1 - Owner: https://github.com/roniemartinez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@48d5ab664c3c41bb3edf5c2729cad062a9d0683a -
Trigger Event:
push
-
Statement type:
File details
Details for the file iptocc-3.0.0a1-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: iptocc-3.0.0a1-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f6e7598df5f2e838be82f8961f3e05e346ec798058e8ae6bff8bb6c749be98f
|
|
| MD5 |
9353693eea846dfb7f293735104a4aae
|
|
| BLAKE2b-256 |
7cc1e62086c97f8531bffb5e2b4e9293c267c1e23b3c77cb18ba8a7d6d42d29d
|
Provenance
The following attestation bundles were made for iptocc-3.0.0a1-cp310-abi3-win_amd64.whl:
Publisher:
publish-pypi.yml on roniemartinez/IPToCC
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iptocc-3.0.0a1-cp310-abi3-win_amd64.whl -
Subject digest:
5f6e7598df5f2e838be82f8961f3e05e346ec798058e8ae6bff8bb6c749be98f - Sigstore transparency entry: 1333370160
- Sigstore integration time:
-
Permalink:
roniemartinez/IPToCC@48d5ab664c3c41bb3edf5c2729cad062a9d0683a -
Branch / Tag:
refs/tags/python-v3.0.0-alpha.1 - Owner: https://github.com/roniemartinez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@48d5ab664c3c41bb3edf5c2729cad062a9d0683a -
Trigger Event:
push
-
Statement type:
File details
Details for the file iptocc-3.0.0a1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: iptocc-3.0.0a1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6753099dee25b474d5296d95e9e8fd4707557e2774720d5a200ed288b843ad95
|
|
| MD5 |
f3f4a700173678f3c82eac425f7c2b33
|
|
| BLAKE2b-256 |
9a9bfa9469fe41b20797b518f06ea2671c84b85379c5dd0caf0b78abdbc46506
|
Provenance
The following attestation bundles were made for iptocc-3.0.0a1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish-pypi.yml on roniemartinez/IPToCC
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iptocc-3.0.0a1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
6753099dee25b474d5296d95e9e8fd4707557e2774720d5a200ed288b843ad95 - Sigstore transparency entry: 1333370109
- Sigstore integration time:
-
Permalink:
roniemartinez/IPToCC@48d5ab664c3c41bb3edf5c2729cad062a9d0683a -
Branch / Tag:
refs/tags/python-v3.0.0-alpha.1 - Owner: https://github.com/roniemartinez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@48d5ab664c3c41bb3edf5c2729cad062a9d0683a -
Trigger Event:
push
-
Statement type:
File details
Details for the file iptocc-3.0.0a1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: iptocc-3.0.0a1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be5c5399aa3865af43911ab8091fb63f827703ee50c21bc21c8efe80331b2057
|
|
| MD5 |
9750bbe81626bcb0d65b7c7d1f29db24
|
|
| BLAKE2b-256 |
ce4965666f16c547f75b69df85365dbffbf78be5ade6bac7763dee35607ea567
|
Provenance
The following attestation bundles were made for iptocc-3.0.0a1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
publish-pypi.yml on roniemartinez/IPToCC
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iptocc-3.0.0a1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
be5c5399aa3865af43911ab8091fb63f827703ee50c21bc21c8efe80331b2057 - Sigstore transparency entry: 1333370018
- Sigstore integration time:
-
Permalink:
roniemartinez/IPToCC@48d5ab664c3c41bb3edf5c2729cad062a9d0683a -
Branch / Tag:
refs/tags/python-v3.0.0-alpha.1 - Owner: https://github.com/roniemartinez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@48d5ab664c3c41bb3edf5c2729cad062a9d0683a -
Trigger Event:
push
-
Statement type:
File details
Details for the file iptocc-3.0.0a1-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: iptocc-3.0.0a1-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5eabcd9fe95e2613d7da63743ac2339e63568706b5a165b94463baa9ded17646
|
|
| MD5 |
af4d448e23e67a340acbcb28c8b18949
|
|
| BLAKE2b-256 |
8cdcd061c3553eb7828e6b9c328bc7e0ddb853af3d78afd2fd0b084612766d34
|
Provenance
The following attestation bundles were made for iptocc-3.0.0a1-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
publish-pypi.yml on roniemartinez/IPToCC
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iptocc-3.0.0a1-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
5eabcd9fe95e2613d7da63743ac2339e63568706b5a165b94463baa9ded17646 - Sigstore transparency entry: 1333370061
- Sigstore integration time:
-
Permalink:
roniemartinez/IPToCC@48d5ab664c3c41bb3edf5c2729cad062a9d0683a -
Branch / Tag:
refs/tags/python-v3.0.0-alpha.1 - Owner: https://github.com/roniemartinez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@48d5ab664c3c41bb3edf5c2729cad062a9d0683a -
Trigger Event:
push
-
Statement type:
File details
Details for the file iptocc-3.0.0a1-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: iptocc-3.0.0a1-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e2c8168f43564f897c3985ea4aa7e594aa9a425251e81634845e3eeab8c50ea
|
|
| MD5 |
623b8280a6a36249209f0640d8e0086b
|
|
| BLAKE2b-256 |
d71c083ae8d16900edf283e63b0ca2e439adf0d4959b568e05914a58d5aea01b
|
Provenance
The following attestation bundles were made for iptocc-3.0.0a1-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
publish-pypi.yml on roniemartinez/IPToCC
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iptocc-3.0.0a1-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
0e2c8168f43564f897c3985ea4aa7e594aa9a425251e81634845e3eeab8c50ea - Sigstore transparency entry: 1333370199
- Sigstore integration time:
-
Permalink:
roniemartinez/IPToCC@48d5ab664c3c41bb3edf5c2729cad062a9d0683a -
Branch / Tag:
refs/tags/python-v3.0.0-alpha.1 - Owner: https://github.com/roniemartinez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@48d5ab664c3c41bb3edf5c2729cad062a9d0683a -
Trigger Event:
push
-
Statement type: