Skip to content

Commit b103bbc

Browse files
[PR #10283/e5d6016c backport][3.11] Clarify purpose of parameters allow_redirects, max_redirects for ClientSession.request (and related functions) (#10284)
**This is a backport of PR #10283 as merged into master (e5d6016).** Co-authored-by: asrelo <[email protected]>
1 parent 1b9fada commit b103bbc

File tree

1 file changed

+28
-11
lines changed

1 file changed

+28
-11
lines changed

docs/client_reference.rst

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,16 @@ The client session supports the context manager protocol for self closing.
448448
:param aiohttp.BasicAuth auth: an object that represents HTTP
449449
Basic Authorization (optional)
450450

451-
:param bool allow_redirects: If set to ``False``, do not follow redirects.
452-
``True`` by default (optional).
451+
:param bool allow_redirects: Whether to process redirects or not.
452+
When ``True``, redirects are followed (up to ``max_redirects`` times)
453+
and logged into :attr:`ClientResponse.history` and ``trace_configs``.
454+
When ``False``, the original response is returned.
455+
``True`` by default (optional).
453456

454457
:param int max_redirects: Maximum number of redirects to follow.
455-
``10`` by default.
458+
:exc:`TooManyRedirects` is raised if the number is exceeded.
459+
Ignored when ``allow_redirects=False``.
460+
``10`` by default.
456461

457462
:param bool compress: Set to ``True`` if request has to be compressed
458463
with deflate encoding. If `compress` can not be combined
@@ -554,8 +559,11 @@ The client session supports the context manager protocol for self closing.
554559

555560
:param url: Request URL, :class:`str` or :class:`~yarl.URL`
556561

557-
:param bool allow_redirects: If set to ``False``, do not follow redirects.
558-
``True`` by default (optional).
562+
:param bool allow_redirects: Whether to process redirects or not.
563+
When ``True``, redirects are followed and logged into
564+
:attr:`ClientResponse.history`.
565+
When ``False``, the original response is returned.
566+
``True`` by default (optional).
559567

560568
:return ClientResponse: a :class:`client response
561569
<ClientResponse>` object.
@@ -623,8 +631,11 @@ The client session supports the context manager protocol for self closing.
623631

624632
:param url: Request URL, :class:`str` or :class:`~yarl.URL`
625633

626-
:param bool allow_redirects: If set to ``False``, do not follow redirects.
627-
``False`` by default (optional).
634+
:param bool allow_redirects: Whether to process redirects or not.
635+
When ``True``, redirects are followed and logged into
636+
:attr:`ClientResponse.history`.
637+
When ``False``, the original response is returned.
638+
``False`` by default (optional).
628639

629640
:return ClientResponse: a :class:`client response
630641
<ClientResponse>` object.
@@ -641,8 +652,11 @@ The client session supports the context manager protocol for self closing.
641652

642653
:param url: Request URL, :class:`str` or :class:`~yarl.URL`
643654

644-
:param bool allow_redirects: If set to ``False``, do not follow redirects.
645-
``True`` by default (optional).
655+
:param bool allow_redirects: Whether to process redirects or not.
656+
When ``True``, redirects are followed and logged into
657+
:attr:`ClientResponse.history`.
658+
When ``False``, the original response is returned.
659+
``True`` by default (optional).
646660

647661
:return ClientResponse: a :class:`client response
648662
<ClientResponse>` object.
@@ -874,8 +888,11 @@ certification chaining.
874888
:param aiohttp.BasicAuth auth: an object that represents HTTP Basic
875889
Authorization (optional)
876890

877-
:param bool allow_redirects: If set to ``False``, do not follow redirects.
878-
``True`` by default (optional).
891+
:param bool allow_redirects: Whether to process redirects or not.
892+
When ``True``, redirects are followed (up to ``max_redirects`` times)
893+
and logged into :attr:`ClientResponse.history` and ``trace_configs``.
894+
When ``False``, the original response is returned.
895+
``True`` by default (optional).
879896

880897
:param aiohttp.protocol.HttpVersion version: Request HTTP version (optional)
881898

0 commit comments

Comments
 (0)