@@ -44,7 +44,7 @@ class Client(object):
4444
4545 It accepts the following required arguments:
4646
47- :param user_id : Your MaxMind User ID.
47+ :param account_id : Your MaxMind account ID.
4848 :param license_key: Your MaxMind license key.
4949
5050 Go to https://www.maxmind.com/en/my_license_key to see your MaxMind
@@ -83,7 +83,7 @@ class Client(object):
8383 """
8484
8585 def __init__ (self ,
86- user_id ,
86+ account_id ,
8787 license_key ,
8888 host = 'geoip.maxmind.com' ,
8989 locales = None ,
@@ -95,7 +95,8 @@ def __init__(self,
9595 self ._locales = locales
9696 # requests 2.12.2 requires that the username passed to auth be bytes
9797 # or a string, with the former being preferred.
98- self ._user_id = user_id if isinstance (user_id , bytes ) else str (user_id )
98+ self ._account_id = account_id if isinstance (account_id ,
99+ bytes ) else str (account_id )
99100 self ._license_key = license_key
100101 self ._base_uri = 'https://%s/geoip/v2.1' % host
101102 self ._timeout = timeout
@@ -143,7 +144,7 @@ def _response_for(self, path, model_class, ip_address):
143144 uri = '/' .join ([self ._base_uri , path , ip_address ])
144145 response = requests .get (
145146 uri ,
146- auth = (self ._user_id , self ._license_key ),
147+ auth = (self ._account_id , self ._license_key ),
147148 headers = {
148149 'Accept' : 'application/json' ,
149150 'User-Agent' : self ._user_agent ()
@@ -201,7 +202,8 @@ def _exception_for_4xx_status(self, response, status, uri):
201202 def _exception_for_web_service_error (self , message , code , status , uri ):
202203 if code in ('IP_ADDRESS_NOT_FOUND' , 'IP_ADDRESS_RESERVED' ):
203204 return AddressNotFoundError (message )
204- elif code in ('AUTHORIZATION_INVALID' , 'LICENSE_KEY_REQUIRED' ,
205+ elif code in ('ACCOUNT_ID_REQUIRED' , 'ACCOUNT_ID_UNKNOWN' ,
206+ 'AUTHORIZATION_INVALID' , 'LICENSE_KEY_REQUIRED' ,
205207 'USER_ID_REQUIRED' , 'USER_ID_UNKNOWN' ):
206208 return AuthenticationError (message )
207209 elif code in ('INSUFFICIENT_FUNDS' , 'OUT_OF_QUERIES' ):
0 commit comments