Fix handling of GeoIP lookup failure

This commit is contained in:
sfan5 2019-07-17 12:46:57 +02:00 committed by GitHub
parent 772fc29cb8
commit 85c3048cd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -284,7 +284,7 @@ def asyncFinishThread(server):
except geoip2.errors.GeoIP2Error: except geoip2.errors.GeoIP2Error:
app.logger.warning("GeoIP lookup failure for %s." % (server["address"],)) app.logger.warning("GeoIP lookup failure for %s." % (server["address"],))
if "continent" in geo and "code" in geo["continent"]: if geo and "continent" in geo:
server["geo_continent"] = geo["continent"]["code"] server["geo_continent"] = geo["continent"]["code"]
else: else:
app.logger.warning("Unable to get GeoIP Continent data for %s." app.logger.warning("Unable to get GeoIP Continent data for %s."