diff options
author | neptune | 2021-05-28 02:11:20 -0400 |
---|---|---|
committer | neptune | 2021-05-28 02:11:20 -0400 |
commit | d8c54cd177536c9077325b7c159f88a12b2a2a68 (patch) | |
tree | 01a4f27575ac78ebd2f57eeabfc641cb7f95d8e7 | |
parent | e85319f9e58c6ff3ed2d2d6f33596d8bb71a1f92 (diff) | |
download | weabot-d8c54cd177536c9077325b7c159f88a12b2a2a68.tar.gz weabot-d8c54cd177536c9077325b7c159f88a12b2a2a68.tar.xz weabot-d8c54cd177536c9077325b7c159f88a12b2a2a68.zip |
Actualizado a GeoLite2
-rw-r--r-- | cgi/GeoIP.dat | bin | 878459 -> 0 bytes | |||
-rw-r--r-- | cgi/GeoLite2-Country.mmdb | bin | 0 -> 3990267 bytes | |||
-rw-r--r-- | cgi/framework.py | 6 |
3 files changed, 4 insertions, 2 deletions
diff --git a/cgi/GeoIP.dat b/cgi/GeoIP.dat Binary files differdeleted file mode 100644 index b98993c..0000000 --- a/cgi/GeoIP.dat +++ /dev/null diff --git a/cgi/GeoLite2-Country.mmdb b/cgi/GeoLite2-Country.mmdb Binary files differnew file mode 100644 index 0000000..90c1146 --- /dev/null +++ b/cgi/GeoLite2-Country.mmdb diff --git a/cgi/framework.py b/cgi/framework.py index 94f6f30..faea8d9 100644 --- a/cgi/framework.py +++ b/cgi/framework.py @@ -108,8 +108,10 @@ def getCountry(ip): if ":" in ip: return "v6" else: - import geoip - return geoip.country(ip) + import geoip2.database + with geoip2.database.Reader('GeoLite2-Country.mmdb') as reader: + response = reader.country(ip) + return response.country.iso_code def getHost(ip): |