diff options
| author | Bobby <[email protected]> | 2023-05-31 18:40:15 -0400 |
|---|---|---|
| committer | Bobby <[email protected]> | 2023-05-31 18:40:15 -0400 |
| commit | 7f97aec8917109a3e7f357e98507dde197f2968d (patch) | |
| tree | a435e9ef0848e3e0cb3ee1e0edb5c69b45e6ab51 /middleware | |
| parent | 7689596bf4582d95640386f7495d1786c67678d4 (diff) | |
| download | thatcomputerscientist-7f97aec8917109a3e7f357e98507dde197f2968d.tar.xz thatcomputerscientist-7f97aec8917109a3e7f357e98507dde197f2968d.zip | |
Fix: Geodata not found
Diffstat (limited to 'middleware')
| -rw-r--r-- | middleware/tz.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/middleware/tz.py b/middleware/tz.py index 35565834..05130dbb 100644 --- a/middleware/tz.py +++ b/middleware/tz.py @@ -23,7 +23,7 @@ class TimezoneMiddleware(object): remote_ip = request.META.get('REMOTE_ADDR') geo_data = requests.get(f'http://ip-api.com/json/{remote_ip}').json() - user_timezone = geo_data['timezone'] or 'UTC' + user_timezone = geo_data['timezone'] if 'timezone' in geo_data else 'UTC' if user_timezone: response = self.get_response(request) |
