Package: cs.pop3
POP3 stuff, particularly a streaming downloader and a simple command line which runs it.Latest release 20240201.1:
Another test release, nothing new.I spend some time on a geostationary satellite connection,
where round trip ping times are over 600ms when things are good.My mail setup involves fetching messages from my inbox
for local storage in my laptop, usually using POP3.
The common standalone tools for this arefetchmailandgetmail.
However, both are very subject to the link latency,
in that they request a message, collect it, issue a delete, then repeat.
On a satellite link that incurs a cost of over a second per message,
making catch up after a period offline a many minutes long exercise in tedium.This module does something I've been meaning to do for literally years:
a bulk fetch. It issuesRETRieves for every message up front as fast as possible.
A separate thread collects the messages as they are delivered
and issuesDELEtes for the saved messages as soon as each is saved.This results in a fetch process which is orders of magnitude faster.
Even on a low latency link the throughput is much faster;
on the satellite it is gobsmackingly faster.ClassConnectionSpec(ConnectionSpec, builtins.tuple)A specification for a POP3 connection.Functionmain(argv=None)Thepop3command line mode.ClassNetrcEntry(NetrcEntry, builtins.tuple)Anamedtuplerepresentation of anetrcentry.ClassPOP3(cs.resources.MultiOpenMixin, cs.context.ContextManagerMixin)Simple POP3 class with support for streaming use.ClassPOP3Command(cs.cmdutils.BaseCommand)Command line implementation for POP3 operations.Credentials are obtained via the.netrcfile presently.Connection specifications consist of an optional leading mode prefix
followed by a netrc(5) account name
or an explicit connection specification
from which to derive:user: the user name to log in astcp_host: the hostname to which to establish a TCP connectionport: the TCP port to connect on, default 995 for TLS/SSL or 110 for cleartextsni_host: the TLS/SSL SNI server name, which may be different from thetcp_hostThe optional mode prefix is one of:ssl:: use TLS/SSL - this is the defaulttcp:: use cleartext - this is useful for ssh port forwards
to some not-publicly-exposed clear text POP service;
in particular streaming performs better this way,
I think because the Python SSL layer does not buffer writesExample connection specifications:username@mail.example.com:
use TLS/SSL to connect to the POP3S service atmail.example.com,
logging in asusernamemail.example.com:
use TLS/SSL to connect to the POP3S service atmail.example.com,
logging in with the same login as the local effective usertcp:username@localhost:1110:
use cleartext to connect tolocalhost:1110,
typically an ssh port forward to a remote private cleartext POP service,
logging in asusernameusername@localhost!mail.example.com:1995:
use TLS/SSL to connect tolocalhost:1995,
usually an ssh port forward to a remote private TLS/SSL POP service,
logging in asusernameand passingmail.exampl.comas the TLS/SSL server name indication
(which allows certificate verification to proceed correctly)Note that the specification may also be anetrcaccount name.
If the specification matches such an account name
then values are derived from thenetrcentry.
The entry'smachinename becomes the TCP connection specification,
the entry'sloginprovides a default for the username,
the entry'saccounthost part provides thesni_host.Examplenetrcentry:machine username@localhost:1110
  account username@mail.example.com
  password ************Such an entry allows you to use the specificationtcp:username@mail.example.comand obtain the remaining detail via thenetrcentry.Command line usage:Usage: pop3 subcommand [...]
  Subcommands:
    dl [-n] [{ssl,tcp}:]{netrc_account|[user@]host[!sni_name][:port]} maildir
    help [-l] [subcommand-names...]
      Print the full help for the named subcommands,
      or for all subcommands if no names are specified.
      -l  Long help even if no subcommand-names provided.
    shell
      Run a command prompt via cmd.Cmd using this command's subcommands.Release LogRelease 20240201.1:
Another test release, nothing new.Release 20240201:
Test release with better DISTINFO.Release 20221221:
Fix stray %s in format string, modernise MultiOpenMixin startup/shutdown, catch ConnectionRefusedError and report succintly.Release 20220918:Emit an error instead of stack trace for messages which cannot be saved (and do not delete).POP3Command.cmd_dl: new -n (no action) option.Release 20220606:
Minor updates.Release 20220312:
Make POP3Command.cmd_dl an instance method (static methods broke with the latest cs.cmdutils release).Release 20211208:POP3.startup: do not start the worker queue until authenticated.POP3.get_response: return (None,None,None) at EOF.POP3.shutdown: catch exceptions from client QUIT.Release 20210407.2:
Provide "pop3" console_script.Release 20210407.1:
Bump for cs.cmdutils minor bugfix, also fix a few docstring typos.Release 20210407:
Initial PyPI release.