Skip to content
Myr

Document blocking calls.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Cory Benfield · committed by Cory Benfield · parent 3bb13f8 · Browse files · 1 file+18 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+18 added−0 removed

  • other:+18 added−0 removed

1 file+18 added−0 removed

modified:docs/user/advanced.rst+18 added
266 unmodified lines
267268 >>> requests.get('http://pizzabin.org/admin', auth=PizzaAuth('kenneth'))269 <Response [200]>270271.. _streaming-requests272273Streaming Requests274------------------275276With ``requests.Response.iter_lines()`` you can easily iterate over streaming
298 unmodified lines
575576.. _`described here`: http://kennethreitz.org/exposures/the-future-of-python-http577.. _`urllib3`: https://github.com/shazow/urllib3578579Blocking Or Non-Blocking?580-------------------------581582With the default Transport Adapter in place, Requests does not provide any kind583of non-blocking IO. The ``Response.content`` property will block until the584entire response has been downloaded. If you require more granularity, the585streaming features of the library (see :ref:`streaming-requests`) allow you to586retrieve smaller quantities of the response at a time. However, these calls587will still block.588589If you are concerned about the use of blocking IO, there are lots of projects590out there that combine Requests with one of Python's asynchronicity frameworks.591Two excellent examples are `grequests`_ and `requests-futures`_.592593.. _`grequests`: https://github.com/kennethreitz/grequests594.. _`requests-futures`: https://github.com/ross/requests-futures