diff --git a/docs/api.rst b/docs/api.rst index 86061be9..5e22814a 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -53,6 +53,7 @@ Exceptions .. autoexception:: requests.exceptions.HTTPError .. autoexception:: requests.exceptions.URLRequired .. autoexception:: requests.exceptions.TooManyRedirects +.. autoexception:: requests.exceptions.Timeout Status Code Lookup diff --git a/docs/user/quickstart.rst b/docs/user/quickstart.rst index 53ee6f6e..128c5780 100644 --- a/docs/user/quickstart.rst +++ b/docs/user/quickstart.rst @@ -340,7 +340,7 @@ So, we can access the headers using any capitalization we want:: Cookies ------- -If a response contains some Cookies, you can get quick access to them:: +If a response contains some Cookies, you can quickly access them:: >>> url = 'http://example.com/some/cookie/setting/url' >>> r = requests.get(url) @@ -362,11 +362,16 @@ parameter:: Redirection and History ----------------------- -Requests will automatically perform location redirection for all verbs except +By default Requests will perform location redirection for all verbs except HEAD. -GitHub redirects all HTTP requests to HTTPS. We can use the ``history`` method -of the Response object to track redirection. Let's see what GitHub does:: +We can use the ``history`` property of the Response object to track redirection. + +The :meth:`Response.history` list contains the :class:`Request` objects that +were created in order to complete the request. The list is sorted from the +oldest to the most recent request. + +For example, GitHub redirects all HTTP requests to HTTPS:: >>> r = requests.get('http://github.com') >>> r.url @@ -376,9 +381,6 @@ of the Response object to track redirection. Let's see what GitHub does:: >>> r.history [] -The :class:`Response.history` list contains the :class:`Request` objects that -were created in order to complete the request. The list is sorted from the -oldest to the most recent request. If you're using GET, OPTIONS, POST, PUT, PATCH or DELETE, you can disable redirection handling with the ``allow_redirects`` parameter:: @@ -424,7 +426,7 @@ Errors and Exceptions In the event of a network problem (e.g. DNS failure, refused connection, etc), Requests will raise a :class:`~requests.exceptions.ConnectionError` exception. -In the event of the rare invalid HTTP response, Requests will raise an +In the rare event of an invalid HTTP response, Requests will raise an :class:`~requests.exceptions.HTTPError` exception. If a request times out, a :class:`~requests.exceptions.Timeout` exception is