No project description provided
Project description
identify-ip
A Python library and CLI tool for identifying IP address details — including the IP protocol version and the registered owner (registrant) via RDAP lookup.
Table of Contents
Installation
From PyPI:
pip install identify-ip
From source (latest):
pip install git+https://github.com/nathanea05/identify-ip.git
CLI Usage
Two equivalent commands are registered: identify-ip and idip.
identify-ip <IP Address> [options]
idip <IP Address> [options]
Options
| Flag | Description |
|---|---|
| (none) | Print a full summary line |
-r, --registrant |
Print only the registrant name |
-v, --version |
Print only the IP protocol version (4 or 6) |
-h, --help |
Show help and exit |
Examples
$ identify-ip 8.8.8.8
8.8.8.8 is an IPv4 IP Address Registered by 'Google LLC'.
$ idip 8.8.8.8 -r
Google LLC
$ idip 8.8.8.8 -v
4
$ identify-ip 2606:4700:4700::1111 -r
Cloudflare, Inc.
Exit Codes
| Code | Meaning |
|---|---|
0 |
Success |
1 |
Invalid IP address |
Python Usage
from identify_ip import get_ip_info
# Full summary string
print(get_ip_info("8.8.8.8"))
# "8.8.8.8 is an IPv4 IP Address Registered by 'Google LLC'."
# Registrant name only
print(get_ip_info("8.8.8.8", filt="registrant"))
# "Google LLC"
# IP version only
print(get_ip_info("8.8.8.8", filt="version"))
# "4"
API Reference
get_ip_info(ip_str, filt="all") -> str
The main entry point. Validates the IP, performs an RDAP lookup, and returns a formatted string.
| Parameter | Type | Description |
|---|---|---|
ip_str |
str |
The IP address to look up (IPv4 or IPv6) |
filt |
"all" | "registrant" | "version" |
Controls what is returned |
Returns:
"all"—"<ip> is an IPv<version> IP Address Registered by '<registrant>'.""registrant"— registrant name, or"registrant not found for IP Address <ip>"if unavailable"version"—"4"or"6"
Raises ValueError if ip_str is not a valid IP address.
Lower-level functions
These are importable from identify_ip.idip but are not part of the stable public API.
get_ip_registrant(ip_str) -> str | None
Returns the registrant name for the given IP, or None if not found or the RDAP lookup failed.
get_ip_version(ip_str) -> int
Returns 4 or 6. Raises ValueError for an invalid IP.
get_rdap_data(ip_str, *, base_url=...) -> dict | None
Returns the raw RDAP response as a parsed JSON dict, or None on network/HTTP failure.
How It Works
- The IP string is validated using Python's built-in
ipaddressmodule. - An HTTP GET is sent to
https://rdap.arin.net/registry/ip/<ip>. ARIN's bootstrap service redirects non-ARIN IPs to the correct Regional Internet Registry (RIPE, APNIC, LACNIC, AFRINIC), whichrequestsfollows automatically. - The RDAP JSON response contains nested
entitiesarrays. Each entity can have avcardArray(jCard format) and a list ofroles. The parser searches depth-first for an entity with the"registrant"role and extracts the best available name field (fn→org→name→handle).
Rate Limiting & Retries
The library is designed to be safe to call in a loop:
- Throttle: A minimum of 200 ms is enforced between outbound RDAP requests (module-level).
- Automatic retries: Uses
urllib3.Retry— up to 6 retries with exponential backoff on HTTP 429, 500, 502, 503, and 504. RespectsRetry-Afterresponse headers. - Post-retry 429 handling: If a 429 persists after all retries and the server provides a
Retry-After≤ 60 seconds, the library waits once more (with a small random jitter) and retries. Otherwise it returnsNonerather than blocking indefinitely.
License
identify-ip is distributed under the terms of the MIT license.
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 Distribution
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 identify_ip-0.1.0.tar.gz.
File metadata
- Download URL: identify_ip-0.1.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02fc2f98f119131bc9eb16b085e2bc55209aca0cb7f197fc47afea05ec7b776c
|
|
| MD5 |
40698f1a044e6e9b74ac692714297abc
|
|
| BLAKE2b-256 |
a125921381a6f031ba443006e95a5e403976fc06b8697abcc6f240877f3435ff
|
Provenance
The following attestation bundles were made for identify_ip-0.1.0.tar.gz:
Publisher:
release.yml on nathanea05/identify-ip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
identify_ip-0.1.0.tar.gz -
Subject digest:
02fc2f98f119131bc9eb16b085e2bc55209aca0cb7f197fc47afea05ec7b776c - Sigstore transparency entry: 1734578414
- Sigstore integration time:
-
Permalink:
nathanea05/identify-ip@dc84027ef25e582c2eb753b847e1d420ed159f9c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nathanea05
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dc84027ef25e582c2eb753b847e1d420ed159f9c -
Trigger Event:
push
-
Statement type:
File details
Details for the file identify_ip-0.1.0-py3-none-any.whl.
File metadata
- Download URL: identify_ip-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41c5fa24819de9c566a69ca1a2f6509e7fcbf1b7f99cfafb3ff6e33c3c71579a
|
|
| MD5 |
c974849abf693f99618ecfc1e1573e32
|
|
| BLAKE2b-256 |
e8d2529a6b26f3b59e28a1c253bd9fbd54a2f07da0b354332a8e3ce17783d6fc
|
Provenance
The following attestation bundles were made for identify_ip-0.1.0-py3-none-any.whl:
Publisher:
release.yml on nathanea05/identify-ip
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
identify_ip-0.1.0-py3-none-any.whl -
Subject digest:
41c5fa24819de9c566a69ca1a2f6509e7fcbf1b7f99cfafb3ff6e33c3c71579a - Sigstore transparency entry: 1734578428
- Sigstore integration time:
-
Permalink:
nathanea05/identify-ip@dc84027ef25e582c2eb753b847e1d420ed159f9c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/nathanea05
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dc84027ef25e582c2eb753b847e1d420ed159f9c -
Trigger Event:
push
-
Statement type: