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

Quickstart doc updates
This commit is contained in:
Cory Benfield
2014-07-15 11:40:28 +01:00
2 changed files with 11 additions and 8 deletions
+1
View File
@@ -53,6 +53,7 @@ Exceptions
.. autoexception:: requests.exceptions.HTTPError
.. autoexception:: requests.exceptions.URLRequired
.. autoexception:: requests.exceptions.TooManyRedirects
.. autoexception:: requests.exceptions.Timeout
Status Code Lookup
+10 -8
View File
@@ -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
[<Response [301]>]
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