This introduces the VerifiedHTTPSConnection class to enable better SSL certificate verification.
VerifiedHTTPSConnection extends httplib.HTTPSConnection but adds SSL certificate verification. The CreateSendBase.make_request method, which is used to make all API calls throughout the createsend library, uses an instance of VerifiedHTTPSConnection to make all API calls.
This method of certificate verification replaces the previous method, which was implemented in such a way that there were two separate networking calls made for every API call, one to verify the SSL certificate, and another to make the API call. That obviously wasn't that great.
More tests may eventually be added for the match_hostname method, although this code is take directly from backports.ssl_match_hostname. I didn't want to include a dependency on backports.ssl_match_hostname directly.
This library should eventually be refactored to use requests (which either didn't exist, or was in very early development when I started writing this library).
Coverage remained the same when pulling df7a77164b62d765110e9e00dec125f52b39b5cc on better-ssl-cert-verification into da6e1c1e988ecb59aa0012cafb700a8bb36d383e on master.
This introduces the
VerifiedHTTPSConnection
class to enable better SSL certificate verification.VerifiedHTTPSConnection
extendshttplib.HTTPSConnection
but adds SSL certificate verification. TheCreateSendBase.make_request
method, which is used to make all API calls throughout the createsend library, uses an instance ofVerifiedHTTPSConnection
to make all API calls.This method of certificate verification replaces the previous method, which was implemented in such a way that there were two separate networking calls made for every API call, one to verify the SSL certificate, and another to make the API call. That obviously wasn't that great.
More tests may eventually be added for the
match_hostname
method, although this code is take directly frombackports.ssl_match_hostname
. I didn't want to include a dependency onbackports.ssl_match_hostname
directly.This library should eventually be refactored to use requests (which either didn't exist, or was in very early development when I started writing this library).