Skip to content

Arnowt/MaxMind-DB-Writer-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%