Closed
Description
If you call the iter*
methods more than once for a single streamed request, it fails with an extremely unhelpful error:
>>> r = requests.get('http://www.google.com/', stream=True)
>>> [x for x in r.iter_content(1024)]
>>> [x for x in r.iter_content(1024)]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/requests/utils.py", line 341, in iter_slices
while pos < len(string):
TypeError: object of type 'bool' has no len()
I think it's fine that you can't call the iter* methods twice on a streamed response, but we can easily catch this situation so we should.
Metadata
Metadata
Assignees
Labels
No labels
Activity