Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin.stu.neva.ru!news.astraweb.com!border2.a.newsrouter.astraweb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'argument': 0.05; 'class,': 0.07; 'override': 0.09; 'subject:version': 0.09; 'though...': 0.09; 'cc:addr:python-list': 0.11; '(other': 0.16; 'assumptions': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sub-class': 0.16; 'subject:SSL': 0.16; 'workings': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'seems': 0.21; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'pass': 0.26; 'subject:/': 0.26; 'header :In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'minor': 0.31; 'class': 0.32; 'regular': 0.32; 'skip:_ 10': 0.34; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'library.': 0.36; 'done': 0.36; 'method': 0.36; 'subject:?': 0.36; 'being': 0.38; 'fact': 0.38; 'little': 0.38; 'use.': 0.39; 'either': 0.39; "you're": 0.61; 'feeling': 0.68; 'edwards': 0.91; 'favour': 0.91; 'to:none': 0.92; 'serious': 0.97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=NpXCE8lyEo+0qm6W2BAY3rQammCA98wQo4hgMb9z3b8=; b=ohRAI66OA/4B6XafT0xCoooi6LrlPBm6q6ufzcqiUHVBI6j4xEDaP8UcC/dCcrmb0u NbsAImRJkjBgvAD7PEP6XovWwycHxVzyejVAAASJqef7rByTqvA0ujXNLPGwb0ZRG6J9 VunWnD5Ha+clzN/JGgwozNr23CDcr28m6ar4YEqvwt1RtFl1UDTi9aaVFbRKuxL6zSzy RNKC/i4o/qAkvx0ymFb8Wvun/h6Nj0hLiSL/x6+qlXO1FHtjT1w/oK1FisF8O3GZuhgz 617VYKqX0CwNqJXAnCFbIuDydWj/ZrfasvJwecEDCh/18weNTYv8Wjp9Ez7yIsFZosw2 lu2w== MIME-Version: 1.0 X-Received: by 10.66.181.70 with SMTP id du6mr16076009pac.23.1397094923422; Wed, 09 Apr 2014 18:55:23 -0700 (PDT) In-Reply-To: References: Date: Thu, 10 Apr 2014 11:55:23 +1000 Subject: Re: imaplib: how to specify SSL/TLS protocol version? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397094927 news.xs4all.nl 2909 [2001:888:2000:d::a6]:37717 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69998 On Thu, Apr 10, 2014 at 7:10 AM, Grant Edwards wrote: > I left out a relevent fact: I'm not the one calling IMAP4_. > > That's being done by the imapclient library. There's no way to pass > imapclient a custom class to use. It's hard-waired to call either > imaplib.IMAP4_stream(), imaplib.IMAP4(), or imaplib.IMAP4_SSL(). I > could create an IMAP4_TLS1 class, but I would then have to sub-class > imapclient.IMAPClient and override its _create_IMAP4() method to make > it call my IMAP4_TLS1() class instead of calling imaplib.IMAP4_SSL(). > > Monkey-patching imaplib seems a little better since it it doesn't > depend on assumptions about the internal workings of imapclient (other > than the fact that it uses imaplib.IMAP4_SSL). That's an argument in favour of a minor case of serious monkey-patching. Although if you do feel dirty, try to hold on to that feeling because that is the proper reaction to being told that you're monkey-patching. ChrisA okay, now I feel like a moron... not just a regular moron, though...