Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Avoid the Gates of Hell. Use Linux -- unknown source


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

SubjectAuthor
o Re: imaplib: is this really so unwieldy?Dennis Lee Bieber

1
Re: imaplib: is this really so unwieldy?

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: wlfr...@ix.netcom.com (Dennis Lee Bieber)
Newsgroups: comp.lang.python
Subject: Re: imaplib: is this really so unwieldy?
Date: Tue, 25 May 2021 21:08:34 -0400
Organization: IISS Elusive Unicorn
Lines: 105
Message-ID: <mailman.352.1621992837.3087.python-list@python.org>
References: <d4d433ff-5de6-31df-4234-e93feea454fc@adminart.net>
<YK15bfs3LoHIdhd8@cskk.homeip.net>
<ie7rag5pv8a15lkh3ambd50l6paf2a67fj@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de i4Gmumk9407iBtKyMCITqAZhVGL+pxgHj6u4jzoIYhXg==
Return-Path: <python-python-list@m.gmane-mx.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'argument': 0.04; 'random':
0.05; 'string': 0.05; 'class.': 0.07; 'debug': 0.07; 'paragraph':
0.09; 'received:ciao.gmane.io': 0.09; 'received:gmane.io': 0.09;
'received:list': 0.09; 'rfc': 0.09; 'string,': 0.09; 'import':
0.14; '(default:': 0.16; 'append': 0.16; 'arguments': 0.16;
'cameron': 0.16; 'command.': 0.16; 'heavily': 0.16; 'message-
id:@4ax.com': 0.16; 'module,': 0.16; 'nothing.': 0.16; 'numpy.':
0.16; 'protocol,': 0.16; 'quotes)': 0.16; 'received:116.202':
0.16; 'received:116.202.254': 0.16; 'received:116.202.254.214':
0.16; 'semantics': 0.16; 'simpson': 0.16; 'strings,': 0.16;
'untagged': 0.16; 'white-space': 0.16; 'python': 0.16;
'implement': 0.18; 'supported': 0.18; 'generated': 0.20;
'libraries': 0.20; 'basically': 0.23; 'classes': 0.23;
'exception': 0.23; 'returns': 0.23; 'to:addr:python-list': 0.23;
'command': 0.24; 'header': 0.24; '>>>': 0.26; 'depends': 0.26;
'library': 0.27; 'port': 0.27; 'bit': 0.28; 'module': 0.28;
"isn't": 0.29; 'text': 0.29; '(and': 0.30; 'header:User-Agent:1':
0.31; 'header:Organization:1': 0.31; 'stuff': 0.31; 'expect':
0.31; 'raise': 0.31; "i'm": 0.32; 'program': 0.33; 'class': 0.33;
'server': 0.33; 'same': 0.34; 'following': 0.35; 'contains': 0.35;
'also,': 0.36; 'errors': 0.37; 'changes': 0.37; 'read': 0.38;
'going': 0.38; 'use': 0.38; 'source': 0.38; 'url-
ip:151.101.36.223/32': 0.38; 'url-ip:151.101.36/24': 0.38;
'include': 0.40; 'necessary': 0.40; 'host': 0.40; 'reference':
0.61; 'skip:h 10': 0.61; 'lot': 0.62; 'skip:b 10': 0.62;
'subject:this': 0.63; 'with:': 0.65; 'well': 0.66; 'listed': 0.67;
'url:8': 0.68; 'enclosed': 0.69; 'received:116': 0.71; 'features':
0.76; 'vary': 0.77; 'note:': 0.79; 'left': 0.79; 'client': 0.79;
'2021': 0.84; '"to': 0.84; "'type'": 0.84; 'characters': 0.84;
'converted': 0.84; 'incorrect': 0.84; 'itself.': 0.84;
'subject:really': 0.84; 'url-ip:76/8': 0.84; 'powerful': 0.86;
'mailbox': 0.91; 'duplicate': 0.93
X-Injected-Via-Gmane: http://gmane.org/
User-Agent: ForteAgent/8.00.32.1272
X-No-Archive: YES
X-Mailman-Approved-At: Tue, 25 May 2021 21:33:56 -0400
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: <ie7rag5pv8a15lkh3ambd50l6paf2a67fj@4ax.com>
X-Mailman-Original-References: <d4d433ff-5de6-31df-4234-e93feea454fc@adminart.net>
<YK15bfs3LoHIdhd8@cskk.homeip.net>
 by: Dennis Lee Bieber - Wed, 26 May 2021 01:08 UTC

On Wed, 26 May 2021 08:25:49 +1000, Cameron Simpson <cs@cskk.id.au>
declaimed the following:

>That depends on the library - it is of course at the whim of the
>developer. Heavily used powerful libraries are usually well documented,
>eg numpy. A random hacker's published module? Might have nothing.
>
>Wrappers for protocols like IMAP might have a bit of doco and expect the
>useful to infer stuff from knowledge of the protocol itself.

Like...

>>> import imaplib
>>> help(imaplib)
Help on module imaplib:

NAME
imaplib - IMAP4 client.

MODULE REFERENCE
https://docs.python.org/3.8/library/imaplib

The following documentation is automatically generated from the Python
source files. It may be incomplete, incorrect or include features that
are considered implementation detail and may vary between Python
implementations. When in doubt, consult the module reference at the
location listed above.

DESCRIPTION
Based on RFC 2060.

Public class: IMAP4
Public variable: Debug
Public functions: Internaldate2tuple
Int2AP
ParseFlags
Time2Internaldate

CLASSES
builtins.object
IMAP4
IMAP4_SSL
IMAP4_stream

class IMAP4(builtins.object)
| IMAP4(host='', port=143)
|
| IMAP4 client class.
|
| Instantiate with: IMAP4([host[, port]])
|
| host - host's name (default: localhost);
| port - port number (default: standard IMAP4 port).
|
| All IMAP4rev1 commands are supported by methods of the same
| name (in lower-case).
|
| All arguments to commands are converted to strings, except for
| AUTHENTICATE, and the last argument to APPEND which is passed as
| an IMAP4 literal. If necessary (the string contains any
| non-printing characters or white-space and isn't enclosed with
| either parentheses or double quotes) each string is quoted.
| However, the 'password' argument to the LOGIN command is always
| quoted. If you want to avoid having an argument string quoted
| (eg: the 'flags' argument to STORE) then enclose the string in
| parentheses (eg: "(\Deleted)").
|
| Each command returns a tuple: (type, [data, ...]) where 'type'
| is usually 'OK' or 'NO', and 'data' is either the text from the
| tagged response, or untagged results from command. Each 'data'
| is either a string, or a tuple. If a tuple, then the first part
| is the header of the response, and the second part contains
| the data (ie: 'literal' value).
|
| Errors raise the exception class <instance>.error("<reason>").
| IMAP4 server errors raise <instance>.abort("<reason>"),
| which is a sub-class of 'error'. Mailbox status changes
| from READ-WRITE to READ-ONLY raise the exception class
| <instance>.readonly("<reason>"), which is a sub-class of 'abort'.
|
| "error" exceptions imply a program error.
| "abort" exceptions imply the connection should be reset, and
| the command re-tried.
| "readonly" exceptions imply the command should be re-tried.
|
| Note: to use this module, you must read the RFCs pertaining to the
| IMAP4 protocol, as the semantics of the arguments to each IMAP4
| command are left to the invoker, not to mention the results. Also,
| most IMAP servers implement a sub-set of the commands available
here.
|
(and a lot more which I'm not going to duplicate -- basically it is the
same text as the on-line documentation without links and coloring...)

However, I would point the OP to the last paragraph shown above: "to
use this module, you must read the RFCs pertaining to the IMAP4
protocol..."

--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor