Skip to content

Commit 7fea191

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

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
@@ -452,11 +452,16 @@ The client session supports the context manager protocol for self closing.
452452
:param aiohttp.BasicAuth auth: an object that represents HTTP
453453
Basic Authorization (optional)
454454

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

458461
:param int max_redirects: Maximum number of redirects to follow.
459-
``10`` by default.
462+
:exc:`TooManyRedirects` is raised if the number is exceeded.
463+
Ignored when ``allow_redirects=False``.
464+
``10`` by default.
460465

461466
:param bool compress: Set to ``True`` if request has to be compressed
462467
with deflate encoding. If `compress` can not be combined
@@ -558,8 +563,11 @@ The client session supports the context manager protocol for self closing.
558563

559564
:param url: Request URL, :class:`str` or :class:`~yarl.URL`
560565

561-
:param bool allow_redirects: If set to ``False``, do not follow redirects.
562-
``True`` by default (optional).
566+
:param bool allow_redirects: Whether to process redirects or not.
567+
When ``True``, redirects are followed and logged into
568+
:attr:`ClientResponse.history`.
569+
When ``False``, the original response is returned.
570+
``True`` by default (optional).
563571

564572
:return ClientResponse: a :class:`client response
565573
<ClientResponse>` object.
@@ -627,8 +635,11 @@ The client session supports the context manager protocol for self closing.
627635

628636
:param url: Request URL, :class:`str` or :class:`~yarl.URL`
629637

630-
:param bool allow_redirects: If set to ``False``, do not follow redirects.
631-
``False`` by default (optional).
638+
:param bool allow_redirects: Whether to process redirects or not.
639+
When ``True``, redirects are followed and logged into
640+
:attr:`ClientResponse.history`.
641+
When ``False``, the original response is returned.
642+
``False`` by default (optional).
632643

633644
:return ClientResponse: a :class:`client response
634645
<ClientResponse>` object.
@@ -645,8 +656,11 @@ The client session supports the context manager protocol for self closing.
645656

646657
:param url: Request URL, :class:`str` or :class:`~yarl.URL`
647658

648-
:param bool allow_redirects: If set to ``False``, do not follow redirects.
649-
``True`` by default (optional).
659+
:param bool allow_redirects: Whether to process redirects or not.
660+
When ``True``, redirects are followed and logged into
661+
:attr:`ClientResponse.history`.
662+
When ``False``, the original response is returned.
663+
``True`` by default (optional).
650664

651665
:return ClientResponse: a :class:`client response
652666
<ClientResponse>` object.
@@ -878,8 +892,11 @@ certification chaining.
878892
:param aiohttp.BasicAuth auth: an object that represents HTTP Basic
879893
Authorization (optional)
880894

881-
:param bool allow_redirects: If set to ``False``, do not follow redirects.
882-
``True`` by default (optional).
895+
:param bool allow_redirects: Whether to process redirects or not.
896+
When ``True``, redirects are followed (up to ``max_redirects`` times)
897+
and logged into :attr:`ClientResponse.history` and ``trace_configs``.
898+
When ``False``, the original response is returned.
899+
``True`` by default (optional).
883900

884901
:param aiohttp.protocol.HttpVersion version: Request HTTP version (optional)
885902

0 commit comments

Comments
 (0)