]>
git.ipfire.org Git - people/ms/libloc.git/blob - examples/python/create-database.py
3 import _location
as location
7 ABS_SRCDIR
= os
.environ
.get("ABS_SRCDIR", ".")
9 private_key_path
= os
.path
.join(ABS_SRCDIR
, "examples/private-key.pem")
11 with
open(private_key_path
, "r") as pkey
:
12 w
= location
.Writer(pkey
)
15 w
.vendor
= "IPFire Project"
18 w
.description
= "This is a geo location database"
24 c
= w
.add_country("DE")
25 c
.continent_code
= "EU"
30 a
.name
= "Lightning Wire Labs GmbH"
35 n
= w
.add_network("2a07:1c44:5800::/40")
38 n
.set_flag(location
.NETWORK_FLAG_ANYCAST
)
42 # Write the database to disk
43 for f
in sys
.argv
[1:]: