Skip to content

Commit

Permalink
Merge pull request #754 from zeehio/patch-1
Browse files Browse the repository at this point in the history
Avoid 500 server error with IPv6 addresses (GeoIP)
  • Loading branch information
jsteffen committed Oct 28, 2014
2 parents 4c28d70 + eadff69 commit 1512cfc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion metashare/stats/geoip.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ def getcountry_coords(countrycode):

def getcountry_code(ipaddress):
if (ipaddress != "" and not is_privateIP(ipaddress)):
return geoip.country_code_by_addr(ipaddress)
try:
return geoip.country_code_by_addr(ipaddress)
except pygeoip.GeoIPError:
return ""
return ""

0 comments on commit 1512cfc

Please sign in to comment.