Skip to content

Commit

Permalink
ncorrect import prevents geoip2 to be used even when available
Browse files Browse the repository at this point in the history
Fixes #22
  • Loading branch information
Tamas Szabo committed Oct 5, 2016
1 parent b876c85 commit 43895f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions iprestrict/geoip.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
available_geoip = 2
try:
from django.contrib.gis.geoip2 import GeoIP2
from django.contrib.gis.geoip2.errors import AddressNotFoundError
from geoip2.errors import AddressNotFoundError
except ImportError:
available_geoip = 1
try:
Expand All @@ -36,7 +36,7 @@
class AdaptedGeoIP2(object):
'''Makes GeoIP2 behave like GeoIP'''
def __init__(self, *args, **kwargs):
self._geoip = GeoIP2
self._geoip = GeoIP2()

def country_code(self, ip):
# if the IP isn't in the DB return None instead of throwing an Exception as GeoIP does
Expand Down

0 comments on commit 43895f7

Please sign in to comment.