fix Issue #1861: Client request timeout parameters are inconsistent #1862
+17
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What do these changes do?
Use sentinel (instead of
None
) for checking the timeout arguments passed.aiohttp/client.py:
read_timeout
argument default value tosentinel
sentinel
during the call, set it to the value ofDEFAULT_TIMEOUT
timeout
argument default value tosentinel
sentinel
during the call, set it to the value ofself.read_timeout
Update documentation to match the consistent usage of timeouts.
Update tests (excluding the confusing
timeout=None
argument usage).Are there changes in behavior for the user?
read_timeout
argument toClientSession
constructor, when omitted, now defaults toDEFAULT_TIMEOUT
which is 5 min, and not toNone
which is no timeout.timeout
argument should be omitted in session'srequest()
methods in order to use the session'sread_timeout
.timeout
argument explicitly passed asNone
to session'srequest()
methods now disables the request timeout instead of resulting in the session'sread_timeout
being used.Related issue number
Issue #1861 Client request timeout parameters are inconsistent
Checklist
CONTRIBUTORS.txt
CHANGES.rst
#issue_number
format at the end of changelog message. Use Pull Request number if there are no issues for PR or PR covers the issue only partially.