A Python IP enrichment library
Project description
🌐 ipatel — IP Enrichment Library & CLI
🔍 What is ipatel?
ipatel is a lightweight Python library and CLI tool that enriches IP addresses and ASNs with useful metadata:
- 🛰️ ASN (Autonomous System Number)
- 🏢 AS Owner / Organization
- 🌎 Country Code
- 🧭 IP Type — Public / Private / Reserved
- 📶 IP Ranges for ASN
✨ Key Features
- ⚡ Fast and works offline after initial DB download
- 🔄 Auto-updates the enrichment database
- 💻 Simple and intuitive Python API & CLI
- 🧪 Fully tested, clean, and modular codebase
- 📦 Easy to install via
pip
🔧 Installation
pip install ipatel
Command Line Interface (CLI)
ipatel also includes a built-in CLI tool that allows you to enrich IPs and fetch ASN data directly from the terminal.
Basic Syntax
ipatel [-i IP_ADDRESS] [-a ASN] [--update-db] [--version] [-h]
Available Flags
| Flag | Description |
|---|---|
-i, --ip |
Enrich the given IP address. |
-a, --asn |
Lookup IP ranges for the given ASN. |
--update-db |
Force re-download of the DB. |
--version |
Show the installed version. |
-h, --help |
Show usage and help message. |
🚀 Quickstart Guide
🧩 Basic Setup
import ipatel as ip
# Let's declare ip and asn here, to check the quick functionality
test_ip = "8.8.8.8"
test_asn = 15169
🌐 IP Enrichment
🔹 Enrich IP with full metadata
ip.enrich_ip("8.8.8.8")
Returns:
{
'ip': '8.8.8.8',
'asn': 15169,
'country_code': 'US',
'owner': 'GOOGLE',
'ip_type': 'Public'
}
🧠 ASN Lookup Functions
| Function | Description | Example |
|---|---|---|
ip.get_record(ip) |
Full ASN record | ip.get_record("8.8.8.8") |
ip.get_asn(ip) |
Get ASN only | 15169 |
ip.get_country_code(ip) |
Get country code | "US" |
ip.get_owner(ip) |
Get AS owner | "GOOGLE" |
ip.get_ip_ranges_for_asn(asn) |
List of IP ranges for ASN | ip.get_ip_ranges_for_asn(15169) |
🛠️ Utilities
| Function | Description | Output |
|---|---|---|
ip.ip_to_int("8.8.8.8") |
IP → Integer | 134744072 |
ip.int_to_ip(134744072) |
Integer → IP | "8.8.8.8" |
ip.get_ip_type("127.0.0.1") |
Detect IP type | "Loopback" |
🔄 Database Management
| Task | Function | Description |
|---|---|---|
| 📥 Download DB | ip.download_ip2asn_db() |
Manually fetch latest DB |
| 🔁 Ensure Fresh DB | ip.ensure_ip2asn_db() |
Checks & auto-downloads if outdated |
📚 Learn More
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
ipatel-0.1.3.tar.gz
(9.2 kB
view details)
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 ipatel-0.1.3.tar.gz.
File metadata
- Download URL: ipatel-0.1.3.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d32a6a013732538acdf4abc774d29ed6109312639e12726ef704456420966a4
|
|
| MD5 |
7ca50296c1928eb66eaf7d29dc63c203
|
|
| BLAKE2b-256 |
70fef5d55360055acd6687c785ebfa11a6e6ad336e90c2470d7fcb8f9b4705e4
|
File details
Details for the file ipatel-0.1.3-py3-none-any.whl.
File metadata
- Download URL: ipatel-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd6391544a5742f94114d00e33f1a44ab8f59182d399becd576d23e98bf38b9c
|
|
| MD5 |
3e3186567daafaba4cf7bb394278ffbe
|
|
| BLAKE2b-256 |
94a1469d980e4ade70989c31c8477291e503ea6f7e4cd3fd5a0558a141db895b
|