aboutsummaryrefslogtreecommitdiff
path: root/cgi
diff options
context:
space:
mode:
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):