Skip to main content

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

🚀 Quickstart Guide

🔧 Installation

pip install ipatel

🧩 Basic Setup

import ipatel as ip

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

🧪 Test Script

def run_tests():
    ip.ensure_ip2asn_db()
    print(ip.enrich_ip("8.8.8.8"))

if __name__ == "__main__":
    run_tests()

📝 Notes

  • IPv4 only (IPv6 support planned)
  • Handles loopback, private, and reserved IPs safely
  • CLI and API produce consistent outputs

📚 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.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

ipatel-0.1.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file ipatel-0.1.1.tar.gz.

File metadata

  • Download URL: ipatel-0.1.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for ipatel-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2b4fd673f34ae66e39e58738f4688ef3111ec3fa7973d5793de74de3ceeae121
MD5 24ce60eb1a141348572d399cdf1eafb3
BLAKE2b-256 21c948a5fbcf33c543534e0711bd6013f019048dc987c5271ac306495fd068aa

See more details on using hashes here.

File details

Details for the file ipatel-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ipatel-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for ipatel-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 deecf85f11bf16115a259b5544c8868cdc3f340b6cb5f6ce7ba759eea30f6af8
MD5 4bbf18f6bd7e2d79da4fc88a5987c55e
BLAKE2b-256 a9fb129fe833d219597a778b628460a39f967291284b021b338bfa81ce30ae0d

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