Skip to content

Commit 35a1e6d

Browse files
committed
Fixed rebasing issues
1 parent 58d47a7 commit 35a1e6d

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

geoip2/webservices.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ def _response_for(self, path, model_class, ip_address):
208208
headers={'Accept': 'application/json',
209209
'User-Agent': self._user_agent()})
210210
if (response.status_code == 200): #pylint:disable=E1103
211-
if (response.status_code == 200):
212211
body = self._handle_success(response, uri)
213212
return model_class(body, languages=self.languages)
214213
else:
@@ -257,10 +256,10 @@ def _handle_4xx_status(self, response, status, uri):
257256
'Response contains JSON but it does not specify '
258257
'code or error keys', status, uri)
259258
elif response.content:
260-
raise GeoIP2HTTPError('Received a %i for %s with the following '
261-
'body: %s' %
262-
(status, uri, response.content),
263-
status, uri)
259+
raise HTTPError('Received a %i for %s with the following '
260+
'body: %s' %
261+
(status, uri, response.content),
262+
status, uri)
264263
else:
265264
raise HTTPError('Received a %(status)i error for %(uri)s '
266265
'with no body.' % locals(), status, uri)

tests/webservices_test.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,10 @@ def test_no_body_error(self):
128128
httpretty.register_uri(httpretty.GET,
129129
self.base_uri + 'country/' + '1.2.3.7',
130130
body ='',
131-
status=400)
132-
with self.assertRaisesRegex(HTTPError,
133131
status=400,
134132
content_type = self._content_type('country'))
135133
with self.assertRaisesRegex(HTTPError,
136-
'Received a 400 error for .* with no body'):
134+
'Received a 400 error for .* with no body'):
137135
self.client.country('1.2.3.7')
138136

139137
def test_weird_body_error(self):
@@ -164,7 +162,7 @@ def test_bad_body_error(self):
164162
body='bad body',
165163
status=400,
166164
content_type = 'text/plain')
167-
with self.assertRaisesRegex(GeoIP2HTTPError,
165+
with self.assertRaisesRegex(HTTPError,
168166
'Received a .* with the following body'
169167
):
170168
self.client.country('1.2.3.9')

0 commit comments

Comments
 (0)