]> git.ipfire.org Git - people/ms/libloc.git/blame - examples/python/read-database.py
database: Make level variable unsigned (as used in log messages)
[people/ms/libloc.git] / examples / python / read-database.py
CommitLineData
e51e1dec
MT
1#!/usr/bin/python3
2
3import location
4
5# Open the database
6d = location.Database("test.db")
7print(d)
8
9# Try to get information about AS123
10a = d.get_as(123)
11print(a)
12
13# Try to get information about AS204867
14a = d.get_as(204867)
15print(a)
16
17# Search for an IP address in the database
18n = d.lookup("8.8.8.8")
19print(n)
f66f15e1
MT
20
21n = d.lookup("2a07:1c44:5800:1234:1234:1234:1234:1234")
22print(n)