Skip to content
Myr

Merge pull request #2131 from dpursehouse/quickstart-doc-updates

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

Quickstart doc updates

authored by Cory Benfield · committed by Cory Benfield · parents 55df629, a8a4c98 · Browse files · 2 files+11 added−8 removed
This commit

State

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

Diff stats

2 files+11 added−8 removed

  • other:+11 added−8 removed

2 files+11 added−8 removed

modified:docs/user/quickstart.rst+10 added-8 removed
338 unmodified lines
339340Cookies341-------342343If a response contains some Cookies, you can get quick access to them::343If a response contains some Cookies, you can quickly access them::344345 >>> url = 'http://example.com/some/cookie/setting/url'346 >>> r = requests.get(url)347
13 unmodified lines
361362Redirection and History363-----------------------364365Requests will automatically perform location redirection for all verbs except365By default Requests will perform location redirection for all verbs except366HEAD.367368GitHub redirects all HTTP requests to HTTPS. We can use the ``history`` method369of the Response object to track redirection. Let's see what GitHub does::368We can use the ``history`` property of the Response object to track redirection.369370The :meth:`Response.history` list contains the :class:`Request` objects that371were created in order to complete the request. The list is sorted from the372oldest to the most recent request.373374For example, GitHub redirects all HTTP requests to HTTPS::375376 >>> r = requests.get('http://github.com')377 >>> r.url378 'https://github.com/'379 >>> r.status_code380 200381 >>> r.history382 [<Response [301]>]383379The :class:`Response.history` list contains the :class:`Request` objects that380were created in order to complete the request. The list is sorted from the381oldest to the most recent request.384385If you're using GET, OPTIONS, POST, PUT, PATCH or DELETE, you can disable386redirection handling with the ``allow_redirects`` parameter::387
37 unmodified lines
425426In the event of a network problem (e.g. DNS failure, refused connection, etc),427Requests will raise a :class:`~requests.exceptions.ConnectionError` exception.428427In the event of the rare invalid HTTP response, Requests will raise an429In the rare event of an invalid HTTP response, Requests will raise an430:class:`~requests.exceptions.HTTPError` exception.431432If a request times out, a :class:`~requests.exceptions.Timeout` exception is433raised.
10 unmodified lines
modified:docs/api.rst+1 added
51 unmodified lines
52.. autoexception:: requests.exceptions.ConnectionError53.. autoexception:: requests.exceptions.HTTPError54.. autoexception:: requests.exceptions.URLRequired55.. autoexception:: requests.exceptions.TooManyRedirects56.. autoexception:: requests.exceptions.Timeout575859Status Code Lookup60~~~~~~~~~~~~~~~~~~
208 unmodified lines