Fix user location crash
This commit is contained in:
parent
cfa912102c
commit
e3d825c48f
|
@ -113,10 +113,8 @@ def geoip_user_record():
|
||||||
|
|
||||||
def get_user_location():
|
def get_user_location():
|
||||||
remote_ip = request.args.get('ip', request.remote_addr)
|
remote_ip = request.args.get('ip', request.remote_addr)
|
||||||
return maxminddb_reader.get(remote_ip)["location"]
|
maxmind = maxminddb_reader.get(remote_ip)["location"]
|
||||||
|
return maxmind["location"] if maxmind else None
|
||||||
gir = geoip_user_record()
|
|
||||||
return (gir["latitude"], gir["longitude"]) if gir else None
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
|
|
Loading…
Reference in a new issue