projects
/
services
/
python-requests.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d28d45a
)
raise RuntimeError when a single streamed request calls *iter methods than once
author
Tim Konick
<konick781@gmail.com>
Mon, 22 Sep 2014 16:04:29 +0000
(12:04 -0400)
committer
Tim Konick
<konick781@gmail.com>
Mon, 22 Sep 2014 16:04:29 +0000
(12:04 -0400)
requests/models.py
patch
|
blob
|
history
diff --git
a/requests/models.py
b/requests/models.py
index bbf08c81358cfdd208c1301cbc209855355da178..a6af6427600ef98674e8c2cb7db51f8d29ccfc07 100644
(file)
--- a/
requests/models.py
+++ b/
requests/models.py
@@
-655,8
+655,12
@@
class Response(object):
self._content_consumed = True
- # simulate reading small chunks of the content
- reused_chunks = iter_slices(self._content, chunk_size)
+ if self._content_consumed and isinstance(self._content, bool):
+ raise RuntimeError(
+ 'The content for this response was already consumed')
+ else:
+ # simulate reading small chunks of the content
+ reused_chunks = iter_slices(self._content, chunk_size)
stream_chunks = generate()