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
- Fork the repo
- Create a feature branch (
git checkout -b feature/foo) - Commit your changes (
git commit -am 'Add foo feature') - Push to the branch (
git push origin feature/foo) - Open a pull request
License
MIT License – see LICENSE for details.
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
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 simple_ip_tools-0.2.0-py3-none-any.whl.
File metadata
- Download URL: simple_ip_tools-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20f4b0c29ef977bf726135d079c42be18b0cbaa2b276b0e0837c5e5ba150769a
|
|
| MD5 |
a55a12d748a17c9fda583be9401ee9f2
|
|
| BLAKE2b-256 |
ba0fa481f4b4bfeb66e4b2a4cd09851ac207ac879c50dc78b79c239924626a7b
|