This is probably just lack of familiarity with Python and the documentation rather than a duck typing issue.
In your particular example, you have to follow the documentation a bit.
In the SMTP.starttls()
method, it says:
If keyfile and certfile are provided, these are passed to the socket module’s ssl() function.
If you follow that link, you will see:
The keyfile and certfile parameters specify optional files which contain a certificate to be used to identify the local side of the connection. See the discussion of Certificates for more information on how the certificate is stored in the certfile.
Edit: The keyfile
and certfile
parameters appear to be filenames (strings). If you then follow the link to Certificates you'll see that the files should be in PEM format.
Thanks to J.F. Sebastian for the tip.