Open jhaar opened 8 years ago
Hi Jason, I was successful using pyperler to call Maxmind's writer perl library from python. Example code:
#!/usr/bin/env python3
import pyperler
i = pyperler.Interpreter()
tree = i.use("MaxMind::DB::Writer::Tree")
types_t = i("my %types = (city => 'map', \
traits => 'map', \
country => 'map', \
); sub { $types{ $_[0] } }")
treeInst = tree.new(ip_version=6,
record_size=28,
database_type='GeoIP2-City',
languages=['en'],
description = {'en': 'test-db'},
map_key_type_callback=types_t,
alias_ipv6_to_ipv4=True
# merge_record_collisions = True
)
treeInst.insert_network(ip, record)
# ...
fh = i.use("FileHandle")
fh = fh.new()
fh.open('>' + 'geocity.mmdb')
treeInst.write_tree(fh)
Hi there
I'd first like to thank you for your csv2dat.py script. I have used it to merge the lat/long positions of our internal 10/8 network subnets into the maxmind CSV files and now we can do things like have maps showing our internal devices using websites/etc as well as Internet :-)
However, now we're seeing applications that only support the newer MMDB format. Have you thought about adding support for that as an option? So far there only seems to be a perl "writer" from Maxmind - but nothing for python :-(
In any case, thanks for your work!
Jason