From 327512f5ef9eea79a0cb324ba47e7eabf6967b3a Mon Sep 17 00:00:00 2001 From: Frankie Robertson Date: Thu, 29 Sep 2016 23:07:16 +0900 Subject: [PATCH] Remove error swallowing exception catching of AttributeError --- requests/models.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/requests/models.py b/requests/models.py index 57ab7700..f5496a96 100644 --- a/requests/models.py +++ b/requests/models.py @@ -747,18 +747,14 @@ class Response(object): if self._content is False: # Read the contents. - try: - if self._content_consumed: - raise RuntimeError( - 'The content for this response was already consumed') + if self._content_consumed: + raise RuntimeError( + 'The content for this response was already consumed') - if self.status_code == 0: - self._content = None - else: - self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes() - - except AttributeError: + if self.status_code == 0: self._content = None + else: + self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes() self._content_consumed = True # don't need to release the connection; that's been handled by urllib3