Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Multiple calls to iter* fail with unhelpful error. #2240
If you call the
>>> 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.