Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

6 May, 2024: The networking issue during the past two days has been identified and appears to be fixed. Will keep monitoring.


devel / comp.lang.python / Re: imaplib: is this really so unwieldy?

SubjectAuthor
o Re: imaplib: is this really so unwieldy?Skip Montanaro

1
Re: imaplib: is this really so unwieldy?

<mailman.334.1621944085.3087.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=13314&group=comp.lang.python#13314

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: skip.mon...@gmail.com (Skip Montanaro)
Newsgroups: comp.lang.python
Subject: Re: imaplib: is this really so unwieldy?
Date: Tue, 25 May 2021 07:00:55 -0500
Lines: 19
Message-ID: <mailman.334.1621944085.3087.python-list@python.org>
References: <21fb6c5f-97a4-654b-887f-2c31a549bcbe@adminart.net>
<CANc-5Ux6KPMu-b-4qdZ-t0FX+MWQ-9do89L+2wYq87dmTE2W-A@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de POLbZ+8TWlKnYDoNHZ0UggISIEqP3CVIQ3aczer7MwMQ==
Return-Path: <skip.montanaro@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=ZJlzHPYD;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.005
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'url-ip:140.82/16': 0.03;
'<>,': 0.09; 'cc:addr:python-list': 0.09; 'received:209.85.219':
0.09; 'url-ip:151.101.0.223/32': 0.09; 'url-
ip:151.101.128.223/32': 0.09; 'url-ip:151.101.192.223/32': 0.09;
'url-ip:151.101.64.223/32': 0.09; 'url-ip:140/8': 0.12;
'url:github': 0.13; '&gt;': 0.14; 'problem': 0.15; '936': 0.16;
'api.': 0.16; 'cc:name:python': 0.16; 'packages,': 0.16;
'received:209.85.219.177': 0.16; 'received:mail-
yb1-f177.google.com': 0.16; 'url:project': 0.16; 'url:pypi': 0.16;
'python': 0.16; 'api': 0.18; 'cc:addr:python.org': 0.19; 'code':
0.24; 'idea': 0.25; 'chris': 0.26; 'seems': 0.26; 'cc:2**0': 0.27;
'(as': 0.27; 'wrong': 0.27; "didn't": 0.29; 'it,': 0.31; 'but':
0.31; '(with': 0.31; 'program,': 0.31; "i'm": 0.32; 'message-
id:@mail.gmail.com': 0.33; 'using': 0.33; 'header:In-Reply-To:1':
0.33; 'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'received:209.85': 0.38; "it's": 0.38; 'received:209': 0.38;
'put': 0.39; 'pretty': 0.40; 'url-ip:151.101.0/24': 0.63; 'url-
ip:151.101.128/24': 0.63; 'url-ip:151.101.192/24': 0.63; 'url-
ip:151.101.64/24': 0.63; 'subject:this': 0.63; 'once': 0.64;
'back': 0.65; 'instead,': 0.65; 'spend': 0.65; 'landing': 0.69;
'away': 0.70; 'eventually': 0.84; 'steal': 0.84; 'subject:really':
0.84; 'think,': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=eWfoD0Co4PeGuPbaFNeZvqRUTBqtg5jMzdKNCVL5nWk=;
b=ZJlzHPYDOseEFyJndscfTfzN1G28NhkddSS6FYw1zYJF16cSO43uxS9Aq8V9n2rxSU
JAyD51hl+kGXSkC3/qBJ6XNeghurph0GyVP46J5miMwBHzbCJNgLSQE2mkVv2C2NQyu/
zgX9qtkG778X+BAEpyMf6bsZcPcUTCz4UEZXMhoTtud4nqw9XFZ6f91EMNJ2RF2Sc6qt
Q4+j/XBwh82iyMvvhvUW0dDLqScuGSp9NLsULJTU93ylXYldyDJZCeYTTjHDVzsCKOlo
VXvmr7rZmpJVxgffQOrtP2QUsECHnYl7uhpud9cjZQ91yeWzZ+g1cGJHTx54RTxmYJW7
rUSA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=eWfoD0Co4PeGuPbaFNeZvqRUTBqtg5jMzdKNCVL5nWk=;
b=MJIaEh8R2hEydESWuwhD+c5PtyQfcuwr1bR3uEhEyjQX/niH1gol2u6pth6pi60zmh
ifjlJ+8oDelfU1+RQEot0wiagq2KpaVkd08VAUCWGAh83YHN3iOOm2oYfW1tQhxbNNYh
Wxo/Lqf5MGRItAoG+SQMxCzDkMFCDizn4lrunGRKfSWHekuKUEhhIbg4GjnZlvUPDlx3
mq9O3XI6Ro+mna+fh48xWfVN5W+X/n43Xvz/hH6G5ldvRHPgbENXXzCEXfFyo9wkCWld
UO64rhH5O/V1Gm+lS7Z7G/uoGIU3VDwHryWgrwGimCvGbwQ/hYGTXMwA7Rz4HcWLeUIo
L1xA==
X-Gm-Message-State: AOAM533PJ46lPSRXCJ65q7GkWf0YhSToj1HeAMDLjhkvVzdVsycW4Yvo
ESLMijx8JQyAkkqI//LEdchiCu9vXcJU4Dj0Sq6hDl1Ur8Lk
X-Google-Smtp-Source: ABdhPJyOzDuh+78IfV3+/NQUZnaBcIU65XNUj5jJSol9GHL/aKEPGeNDnAMdptDXQgZ+mCVwH2xmOvjGWLAnNyVBlfI=
X-Received: by 2002:a25:a26a:: with SMTP id b97mr41151109ybi.62.1621944081998;
Tue, 25 May 2021 05:01:21 -0700 (PDT)
In-Reply-To: <21fb6c5f-97a4-654b-887f-2c31a549bcbe@adminart.net>
X-Content-Filtered-By: Mailman/MimeDel 2.1.34
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CANc-5Ux6KPMu-b-4qdZ-t0FX+MWQ-9do89L+2wYq87dmTE2W-A@mail.gmail.com>
X-Mailman-Original-References: <21fb6c5f-97a4-654b-887f-2c31a549bcbe@adminart.net>
 by: Skip Montanaro - Tue, 25 May 2021 12:00 UTC

> It's working (with Cyrus), but I have the feeling I'm doing it all wrong
> because it seems so unwieldy.

I have a program, Polly <https://github.com/smontanaro/polly>, which I
wrote to generate XKCD 936 passphrases. (I got the idea - and the name -
from Chris Angelico. See the README.) It builds its dictionary from emails
in my Gmail account which are tagged "polly" by a Gmail filter. I had put
it away for a few years, at which time it was still using Python 2. When I
came back to it, I wanted to update it to Python 3. As with so many 2-to-3
ports, the whole bytes/str problem was my stumbling block. Imaplib's API
(as you've discovered) is not the most Pythonic. I didn't spend much time
horsing around with it. Instead, I searched for higher-level packages,
eventually landing on IMAPClient <https://pypi.org/project/IMAPClient/>.
Once I made the switch, things came together pretty quickly, due in large
part, I think, to its more sane API.

YMMV, but you're more than welcome to steal code from Polly.

Skip

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor