imaplib: how to specify SSL/TLS protocol version?
Tim Chase
python.list at tim.thechases.com
Wed Apr 9 16:33:11 EDT 2014
On 2014-04-09 20:20, Grant Edwards wrote:
> I'm not too keen on this approach, but monkey-patching the open()
> method seems to work:
>
> def my_imap4_ssl_open(self, host = '', port = 993):
> self.host = host
> self.port = port
> self.sock = socket.create_connection((host, port))
> self.sslobj = ssl.wrap_socket(self.sock, self.keyfile,
> self.certfile, ssl_version=ssl.PROTOCOL_TLSv1) self.file =
> self.sslobj.makefile('rb')
>
> imaplib.IMAP4_SSL.open = my_imap4_ssl_open
Our messages passed in the ether. You don't have to feel dirty
for monkey-patching, as you can just do it with inheritance.
-tkc
More information about the Python-list
mailing list