We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 617727c commit 416e054Copy full SHA for 416e054
1 file changed
user_sessions/templatetags/user_sessions.py
@@ -107,15 +107,22 @@ def device(value):
107
108
@register.filter
109
def city(value):
110
- location = geoip() and geoip().city(value)
+ try:
111
+ location = geoip() and geoip().city(value)
112
+ except Exception:
113
+ location = None
114
if location and location['city']:
115
return location['city']
116
return None
117
118
119
120
def country(value):
- location = geoip() and geoip().country(value)
121
122
+ location = geoip() and geoip().country(value)
123
+ except Exception as e:
124
+ warnings.warn(str(e), stacklevel=2)
125
126
if location and location['country_name']:
127
return location['country_name']
128
0 commit comments