Skip to main content

A simple IP address to country mapping tool

Project description

simple_ip_tools

A small Python library for managing IP networks using the standard ipaddress module and efficient prefix lookups with pytricia.

Features

  • Add, remove, and list IPv4/IPv6 networks
  • Fast longest‑prefix match queries
  • Simple, lightweight API

Requirements

  • Python 3.6+
  • pytricia
  • ipaddress (built‑in on Python ≥3.3; installed via requirements for older versions)

Installation

pip install -r requirements.txt

or for local development:

pip install -e .

Usage

import simple_ip_tools

simple_ip_tools.gen_db_from_maxmind_csv("ipdb.bin")
ipdb = simple_ip_tools.load_db("ipdb.bin")
simple_ip_tools.lookup_db(ipdb, "1.2.3.4")
simple_ip_tools.lookup_db(ipdb, "2a01:cb06:c200:3e51:103d:6143:42e0:3d48")

Contributing

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/foo)
  3. Commit your changes (git commit -am 'Add foo feature')
  4. Push to the branch (git push origin feature/foo)
  5. Open a pull request

License

MIT License – see LICENSE for details.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

simple_ip_tools-0.2.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file simple_ip_tools-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_ip_tools-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6bf7e8b22b796e4bcf2ea5e9ebedddde3340ca60bbb01626edc3ac4d267ffc25
MD5 f0ba35b13ddbe25d1194756f89c73661
BLAKE2b-256 a4ca929c8a4536023ccdf29d4360f1b9d958fd0aa462b6bf5e2413e35c92ea21

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