File: netspeed.py

package info (click to toggle)
python-geoip 1.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 352 kB
  • sloc: ansic: 753; python: 248; makefile: 4
file content (15 lines) | stat: -rw-r--r-- 386 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/python

from __future__ import print_function

import GeoIP

gi = GeoIP.open(
    "/usr/share/GeoIP/GeoIPNetspeed.dat", GeoIP.GEOIP_STANDARD)

# GEOIP_UNKNOWN_SPEED, GEOIP_DIALUP_SPEED, GEOIP_CABLEDSL_SPEED or
# GEOIP_CORPORATE_SPEED

print(gi.id_by_name("yahoo.com"))
print(gi.id_by_name("www.maxmind.com") == GeoIP.GEOIP_UNKNOWN_SPEED)
print(gi.id_by_addr("203.195.93.0"))