@@ -93,7 +93,7 @@ def __init__(self, user_id, license_key, host='geoip.maxmind.com',
9393 self .locales = locales
9494 self .user_id = user_id
9595 self .license_key = license_key
96- self ._base_uri = 'https://%s/geoip/v2.0' % ( host )
96+ self ._base_uri = 'https://%s/geoip/v2.0' % host
9797
9898 def city (self , ip_address = 'me' ):
9999 """This method calls the GeoIP2 Precision City endpoint.
@@ -152,7 +152,7 @@ def _response_for(self, path, model_class, ip_address):
152152 response = requests .get (uri , auth = (self .user_id , self .license_key ),
153153 headers = {'Accept' : 'application/json' ,
154154 'User-Agent' : self ._user_agent ()})
155- if ( response .status_code == 200 ) : # pylint:disable=E1103
155+ if response .status_code == 200 : # pylint:disable=E1103
156156 body = self ._handle_success (response , uri )
157157 return model_class (body , locales = self .locales )
158158 else :
@@ -174,9 +174,9 @@ def _handle_success(self, response, uri):
174174 def _handle_error (self , response , uri ):
175175 status = response .status_code
176176
177- if status >= 400 and status < 499 :
177+ if 400 <= status < 499 :
178178 self ._handle_4xx_status (response , status , uri )
179- elif status >= 500 and status < 599 :
179+ elif 500 <= status < 599 :
180180 self ._handle_5xx_status (status , uri )
181181 else :
182182 self ._handle_non_200_status (status , uri )
0 commit comments