]> git.ipfire.org Git - people/ms/libloc.git/blob - examples/python/read-database.py
2f59dec4ecc96d777cf0ee1331ea058da5fa7f82
[people/ms/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)