From 4f428228d7e48ac2b254d7a2d1869241c6fb213c Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 23 Nov 2016 21:15:07 +0000 Subject: [PATCH] Make Response.content() return None if status_code is None Fix #3698. --- requests/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requests/models.py b/requests/models.py index 24aa9ae3..cce629bb 100644 --- a/requests/models.py +++ b/requests/models.py @@ -769,7 +769,7 @@ class Response(object): raise RuntimeError( 'The content for this response was already consumed') - if self.status_code == 0: + if not self.status_code: self._content = None else: self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()