Skip to content

Commit

Permalink
- Monitoring GeoIP error management
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed May 8, 2018
1 parent d9d8e84 commit 501edfa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions geonode/contrib/monitoring/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,13 @@ def from_geoserver(cls, service, request_data, received=None):
country = region = city = None
if ip:
geoip = get_geoip()
client_loc = geoip.city(ip)
try:
client_loc = geoip.city(ip)
except:
client_loc = None
if client_loc:
lat, lon = client_loc['latitude'], client_loc['longitude'],
country = client_loc['country_code3']
country = client_loc['country_code3'] if 'country_code3' in client_loc else None
region = client_loc['region']
city = client_loc['city']

Expand Down

0 comments on commit 501edfa

Please sign in to comment.