fastly / fastly-py

A Fastly API client for Python
https://pypi.org/project/fastly/
MIT License
77 stars 60 forks source link

Add Python3 Support with Python2 Backwards Compatibility #33

Closed verkaufer closed 6 years ago

verkaufer commented 6 years ago

After discussing PR #31 and deciding that Python 2.7 compatibility is still needed, this PR adds Python 3 support while maintaining backwards compatibility with Python 2.7.

Backwards compatibility was accomplished by adding a dependency for the six package.

TLS 1.2 Compatibility & Python 2 Caveats

Fastly updated their APIs on June 19, 2018 to require TLS1.2 for all secure connections. As such, the earliest Python 2 version supported is 2.7.9 if we set the correct "context" for HTTPS connections. However: The python docs recommend using the SSL context PROTOCOL_TLS instead of specifying specific TLS versions.

That said, I went ahead and set the SSL Context to use PROTOCOL_TLS which requires Python 2.7.13

verkaufer commented 6 years ago

I neglected to set a version value for this package. Not sure how Fastly wants to bump up this version, since it's not a breaking change but it's definitely significant.

verkaufer commented 6 years ago

@psbanka Tests were readded and I removed that commented line.

Also fixed a few formatting issues :)