Make mmdb format ip library file which can be read by maxmind official language reader
Project description
MaxMind-DB-Writer-python
Make mmdb
format ip library file which can be read by maxmind
official language reader
The official perl writer was written in perl, which was difficult to customize. So I implemented the MaxmindDB format
ip library in python language
Install
pip install -U git+https://github.com/VimT/MaxMind-DB-Writer-python
Usage
from netaddr import IPSet
from mmdb_writer import MMDBWriter
writer = MMDBWriter()
writer.insert_network(IPSet(['1.1.0.0/24', '1.1.1.0/24']), {'country': 'COUNTRY', 'isp': 'ISP'})
writer.to_db_file('test.mmdb')
import maxminddb
m = maxminddb.open_database('test.mmdb')
r = m.get('1.1.1.1')
assert r == {'country': 'COUNTRY', 'isp': 'ISP'}
Examples
see csv_to_mmdb.py
Reference:
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 Distribution
mmdb_writer-0.1.1.tar.gz
(6.0 kB
view hashes)
Built Distribution
Close
Hashes for mmdb_writer-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17a6aa9a9107bdaabf28c9b60c843703c34c5167193330f577c3ea6c31021426 |
|
MD5 | 13c4d9beb1c0c836cdfa1ef17ae5408c |
|
BLAKE2b-256 | 26b3d3209d17f96385ca25918c9ae04c6592c46ae23fb8721689be770c2c12cb |