aboutsummaryrefslogtreecommitdiff
path: root/cgi/framework.py
diff options
context:
space:
mode:
Diffstat (limited to 'cgi/framework.py')
-rw-r--r--cgi/framework.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/cgi/framework.py b/cgi/framework.py
index cfc1fd3..0f62fff 100644
--- a/cgi/framework.py
+++ b/cgi/framework.py
@@ -105,7 +105,7 @@ def addressIsProxy(ip):
def addressIsES(ip):
ES = ['AR', 'BO', 'CL', 'CO', 'CR', 'CU', 'EC', 'ES', 'GF',
'GY', 'GT', 'HN', 'MX', 'NI', 'PA', 'PE', 'PY', 'PR',
- 'SR', 'UY', 'VE', 'v6'] # 'BR',
+ 'SR', 'UY', 'VE'] # 'BR',
return getCountry(ip) in ES
@@ -114,18 +114,14 @@ def addressIsBannedCountry(ip):
def getCountry(ip):
- if ":" in ip:
- return "v6"
- else:
- import geoip2.database
- import geoip2.errors
- try:
- with geoip2.database.Reader('GeoLite2-Country.mmdb') as reader:
- response = reader.country(ip)
- return response.country.iso_code
- except geoip2.errors.AddressNotFoundError:
- return "??"
-
+ import geoip2.database
+ import geoip2.errors
+ try:
+ with geoip2.database.Reader('GeoLite2-Country.mmdb') as reader:
+ response = reader.country(ip)
+ return response.country.iso_code
+ except geoip2.errors.AddressNotFoundError:
+ return "??"
def clearCache():
if Settings._.CONN: