From 3d0a1eb90d67d6489feb76fd548df0416ec9c73b Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Wed, 16 Oct 2013 16:59:22 -0400 Subject: [PATCH] fix doc for redirction and history In current version of requests, allow_redirect is disabled by default only for HEAD requests --- docs/user/quickstart.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/user/quickstart.rst b/docs/user/quickstart.rst index 23a5e89..f639b0a 100644 --- a/docs/user/quickstart.rst +++ b/docs/user/quickstart.rst @@ -339,8 +339,7 @@ parameter:: Redirection and History ----------------------- -Requests will automatically perform location redirection while using the GET -and OPTIONS verbs. +Requests will automatically perform location redirection except for HEAD verb. 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:: @@ -357,8 +356,8 @@ 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 or OPTIONS, you can disable redirection handling with the -``allow_redirects`` parameter:: +If you're using GET, OPTIONS, POST, PUT, PATCH or DELETE, you can disable +redirection handling with the ``allow_redirects`` parameter:: >>> r = requests.get('http://github.com', allow_redirects=False) >>> r.status_code @@ -366,8 +365,7 @@ If you're using GET or OPTIONS, you can disable redirection handling with the >>> r.history [] -If you're using POST, PUT, PATCH, DELETE or HEAD, you can enable -redirection as well:: +If you're using HEAD, you can enable redirection as well:: >>> r = requests.post('http://github.com', allow_redirects=True) >>> r.url -- 2.34.1