Revise tls upgrade process in newer versions of python #164
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.
Resolves #134
The current process used for tls is deprecated and will be removed in python 3.9. In python 3.7, start_tls was added, which is a cleaner way to do the tls upgrade process than what is currently implemented. This requires manually creating the stream reader/writer from a transport and protocol, but it isn't that hard to do. I left the previous method for python 3.5 and 3.6, as
start_tls
wasn't present for those versions.Additionally, the
allow_failures
section of the ci config doesn't actually run those configurations, it just allows failures, so they must be run in the main section. Because of this, python 3.6 and 3.8 weren't being run in ci. I made 3.8 non-optional but left 3.6 as optional, as the tests use an api introduced in 3.7, and an exception class for tls hostname mismatches appears to be different in 3.6.@wallyqs