aboutsummaryrefslogtreecommitdiff
path: root/cgi
diff options
context:
space:
mode:
authorLibravatar neptune 2021-05-28 02:11:20 -0400
committerLibravatar neptune 2021-05-28 02:11:20 -0400
commitd8c54cd177536c9077325b7c159f88a12b2a2a68 (patch)
tree01a4f27575ac78ebd2f57eeabfc641cb7f95d8e7 /cgi
parente85319f9e58c6ff3ed2d2d6f33596d8bb71a1f92 (diff)
downloadweabot-d8c54cd177536c9077325b7c159f88a12b2a2a68.tar.gz
weabot-d8c54cd177536c9077325b7c159f88a12b2a2a68.tar.xz
weabot-d8c54cd177536c9077325b7c159f88a12b2a2a68.zip
Actualizado a GeoLite2
Diffstat (limited to 'cgi')
-rw-r--r--cgi/GeoIP.datbin878459 -> 0 bytes
-rw-r--r--cgi/GeoLite2-Country.mmdbbin0 -> 3990267 bytes
-rw-r--r--cgi/framework.py6
3 files changed, 4 insertions, 2 deletions
diff --git a/cgi/GeoIP.dat b/cgi/GeoIP.dat
deleted file mode 100644
index b98993c..0000000
--- a/cgi/GeoIP.dat
+++ /dev/null
Binary files differ
diff --git a/cgi/GeoLite2-Country.mmdb b/cgi/GeoLite2-Country.mmdb
new file mode 100644
index 0000000..90c1146
--- /dev/null
+++ b/cgi/GeoLite2-Country.mmdb
Binary files differ
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):