Skip to content
Myr

document timeouts

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

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 30377ca · Browse files · 1 file+32 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+32 added−0 removed

  • other:+32 added−0 removed

1 file+32 added−0 removed

modified:docs/user/quickstart.rst+32 added
281 unmodified lines
282 >>> r.history283 [<Response [301]>]284285286Timeouts287--------288289You can tell requests to stop waiting for a response after a given number of seconds with the ``timeout`` parameter::290291 >>> requests.get('http://github.com', timeout=0.001)292 Traceback (most recent call last):293 File "<stdin>", line 1, in <module>294 requests.exceptions.Timeout: Request timed out.295296.. admonition:: Note297298 ``timeout`` only effects the connection process itself, not the downloading of the respone body.299300301Note302303Errors and Exceptions304---------------------305306In the event of a network problem (e.g. DNS failure, refused connection, etc),307Requests will raise a :class:`ConnectionError` exception.308309In the event of the rare invalid HTTP response, Requests will raise310an :class:`HTTPError` exception.311312If a request times out, a :class:`Timeout` exception is raised.313314If a request exceeds the configured number of maximum redirections, a :class:`TooManyRedirects` exception is raised.315316All exceptions that Requests explicitly raises inherit from317:class:`requests.exceptions.RequestException`.318319-----------------------320321Ready for more? Check out the :ref:`advanced <advanced>` section.