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.
Description
urllib3>2
does not contain the attributeurllib3.util.ssl_.DEFAULT_CIPHERS
anymoreIn lieu of limiting the requirements file to
urllib3<2
, a code change was requested that would work with all versionsThe solution is to add an SSL context adapter to the requests session that specifies the cipher suites that we would like to allow
There were two options, some details about them can be found here, the first is that we could use
requests.packages.urllib3.util.ssl_.create_urllib3_context
However, we already have some code (which happens to be the code that is breaking) that applies logic in case the module
requests.packages.urllib3.util.ssl_
doesn't exist. As such, we shouldn't use this in case it doesn't exist. A side benefit is that we can remove the logic which was added to account for thisLuckily, we have an analogous function
ssl.create_default_context
upon which we can enforce our custom cipher suite list and then mount it into the requests session. Some similar usage can be found in this issue this module does require importing ssl, but this is a built-in and does not require extra dependencies be installedAs for the cipher suite list, it was copied from the original source code in urllib3 and was appended with the extra suites in this project that were addressing the 'dh key too small' error
Fixes #7
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: