feat: add ssl parameter to ClientSession#13021
Open
NIK-TIGER-BILL wants to merge 2 commits into
Open
Conversation
Signed-off-by: NIK-TIGER-BILL <nik.tiger.bill@github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #13021 +/- ##
==========================================
- Coverage 98.96% 98.95% -0.01%
==========================================
Files 131 131
Lines 48156 48195 +39
Branches 2499 2502 +3
==========================================
+ Hits 47656 47693 +37
- Misses 376 377 +1
- Partials 124 125 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Merging this PR will not alter performance
Comparing Footnotes
|
- Include _SENTINEL in the type annotation for the ssl parameter of _request, ws_connect, and _ws_connect so mypy accepts the sentinel default value. - Add test_default_ssl_ws to cover the default ssl propagation in websocket connections. - Add CHANGES fragment for aio-libs#13021. Signed-off-by: NIK-TIGER-BILL <nik.tiger.bill@github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add an
sslparameter toClientSessionthat is used as the default SSL setting for all requests made by the session.Closes #13006.
Summary
This allows users to configure SSL once on the session instead of either:
ssl=...to every request.TCPConnector(ssl=...)manually, which is less intuitive.When a request is made without an explicit
sslargument, the session's default is used. Per-requestsslvalues still override the session default.Changes
sslparameter toClientSession.__init__._default_ssl._requestand_ws_connectto fall back to_default_sslwhensslis not provided.test_default_sslverifying both session default and per-request override.Tests
Ran the new test and existing proxy/ssl session tests locally:
Result: 3 passed, 1 skipped.