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