IPRange
Store IP Ranges in Redis as sorted sets for fast retrieval
Installation
pip install iprange-python
Usage
from iprange import IPRange
iprange = IPRange()
# Add a new range with some metadata
iprange.add('192.168.0.1/24', {'some': 'data', 'more': 'metadata'})
# Find the most specific range that contains a specific IP
iprange.find('192.168.0.20')
# => {'range': '192.168.0.1/24', 'some': 'data', 'more': 'metadata'}
# Find all ranges that contains a specific IP
iprange.find_all('192.168.0.20')
# => [{'range': '192.168.0.1/24', 'some': 'data', 'more': 'metadata'}]
# Delete the range
iprange.remove('192.168.0.1/24')
You can use it with Redis Cluster too:
from iprange import IPRange
# Requires at least one node for cluster discovery. Multiple nodes is recommended.
startup_nodes = [{'host': '127.0.0.1', 'port': 16379}]
iprange = IPRange(redis_cluster=True, startup_nodes=startup_nodes)
# ...
IPRange in other languages
Notice
This library relies on a Redis fork that implements interval sets, as described in this blog post.
You can also use a more recent version of Redis with Interval Sets.
Metadata
Release files for iprange-python 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iprange-python-0.0.9.tar.gz | 3.5 kB | Without provenance | Details for iprange-python-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iprange_python-0.0.9-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for iprange_python-0.0.9-py2.py3-none-any.whl |
Total release size: 7.1 kB
Release files / iprange-python-0.0.9.tar.gz
| Download URL | iprange-python-0.0.9.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53aeff4de99bd0d83922e0cf49d12fd5978c3dc2b674876c4974068c37341227
|
|
BLAKE2b-256 checksum How to use checksums |
c7d8d0150e7931a7262a0b3b3f0951a79a251236b6a26e2315b63adb8a69211d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.0
|
Release files / iprange_python-0.0.9-py2.py3-none-any.whl
| Download URL | iprange_python-0.0.9-py2.py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
ef9cee3e38ef09c971a7ae7b32a900defeb005a542868e4f5561040868c8c8d5
|
|
BLAKE2b-256 checksum How to use checksums |
2db9951242d6ba9371acec2d161531276717a671ba44aeb3d44dfb10b960d1fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.0
|
Security for iprange-python 0.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.