• File: poplib.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/poplib.cpython-37.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 13.12 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

Rj:@sldZddlZddlZddlZyddlZdZWnek
rDdZYnXddgZGdddeZ	dZ
d	Zd
ZdZ
ee
ZdZGd
ddZerGdddeZededkrhddlZeejdZeeeejdeejdee\ZZxXededD]FZ e!e \Z"Z#Z$ede xe#D]Z%ede%q<WedqWe&dS)z@A POP3 client class.

Based on the J. Myers POP3 draft, Jan. 96
NTFPOP3error_protoc@seZdZdS)rN)__name__
__module____qualname__rr+/opt/alt/python37/lib64/python3.7/poplib.pyrsni

ic@seZdZdZdZeejfddZddZ	ddZ
d	d
ZddZd
dZ
ddZddZddZddZddZddZddZddZd=d d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zed0Z d1d2Z!d3d4Z"d>d5d6Z#d7d8Z$d9d:Z%d?d;d<Z&dS)@raPThis class supports both the minimal and optional command sets.
    Arguments can be strings or integers (where appropriate)
    (e.g.: retr(1) and retr('1') both work equally well.

    Minimal Command Set:
            USER name               user(name)
            PASS string             pass_(string)
            STAT                    stat()
            LIST [msg]              list(msg = None)
            RETR msg                retr(msg)
            DELE msg                dele(msg)
            NOOP                    noop()
            RSET                    rset()
            QUIT                    quit()

    Optional Commands (some servers support these):
            RPOP name               rpop(name)
            APOP name digest        apop(name, digest)
            TOP msg n               top(msg, n)
            UIDL [msg]              uidl(msg = None)
            CAPA                    capa()
            STLS                    stls()
            UTF8                    utf8()

    Raises one exception: 'error_proto'.

    Instantiate with:
            POP3(hostname, port=110)

    NB:     the POP protocol locks the mailbox from user
            authorization until QUIT, so be sure to get in, suck
            the messages, and quit, each time you access the
            mailbox.

            POP is a line-based protocol, which means large mail
            messages consume lots of python cycles reading them
            line-by-line.

            If it's available on your mail server, use IMAP4
            instead, it doesn't suffer from the two problems
            above.
    zUTF-8cCs@||_||_d|_|||_|jd|_d|_||_	dS)NFrbr)
hostport_tls_established_create_socketsockmakefilefile
_debugging_getrespwelcome)selfr
rtimeoutrrr__init__asz
POP3.__init__cCst|j|jf|S)N)socketZcreate_connectionr
r)rrrrrrkszPOP3._create_socketcCs,|jdkrtdt||j|tdS)Nz*put*)rprintreprrZsendallCRLF)rlinerrr_putlinens
z
POP3._putlinecCsB|jrtdt|t||j}td|r4td||dS)Nz*cmd*s[-]z*Control characters not allowed in commands)	rrrbytesencodingresearch
ValueErrorr )rrrrr_putcmduszPOP3._putcmdcCs|jtd}t|tkr$td|jdkr<tdt||sHtdt|}|ddtkrp|dd|fS|ddt	kr|dd|fS|dd|fS)Nrz
line too longz*get*z-ERR EOF)
rreadline_MAXLINElenrrrrrCR)rroctetsrrr_getlines
z
POP3._getlinecCs:|\}}|jdkr$tdt||ds6t||S)Nrz*resp*+)r.rrr
startswithr)rresporrrrs

z
POP3._getrespcCsp|}g}d}|\}}xH|dkrd|drD|d}|dd}||}|||\}}qW|||fS)Nr.s..r)rr.r0append)rr1listr-rr2rrr_getlongresps


zPOP3._getlongrespcCs|||S)N)r&r)rrrrr	_shortcmds
zPOP3._shortcmdcCs|||S)N)r&r6)rrrrr_longcmds
z
POP3._longcmdcCs|jS)N)r)rrrr
getwelcomeszPOP3.getwelcomecCs
||_dS)N)r)rlevelrrrset_debuglevelszPOP3.set_debuglevelcCs|d|S)zVSend user name, return response

        (should indicate password required).
        zUSER %s)r7)ruserrrrr<sz	POP3.usercCs|d|S)zSend password, return response

        (response includes message count, mailbox size).

        NB: mailbox is locked by server from here to 'quit()'
        zPASS %s)r7)rZpswdrrrpass_sz
POP3.pass_cCsF|d}|}|jr&tdt|t|d}t|d}||fS)z]Get mailbox status.

        Result is tuple of 2 ints (message count, mailbox size)
        ZSTATz*stat*r)r7splitrrrint)rZretvalZretsZnumMessagesZsizeMessagesrrrstats
z	POP3.statNcCs |dk	r|d|S|dS)aRequest listing, return result.

        Result without a message number argument is in form
        ['response', ['mesg_num octets', ...], octets].

        Result when a message number argument is given is a
        single response: the "scan listing" for that message.
        NzLIST %sZLIST)r7r8)rwhichrrrr5s	z	POP3.listcCs|d|S)zoRetrieve whole message number 'which'.

        Result is in form ['response', ['line', ...], octets].
        zRETR %s)r8)rrBrrrretrsz	POP3.retrcCs|d|S)zFDelete message number 'which'.

        Result is 'response'.
        zDELE %s)r7)rrBrrrdelesz	POP3.delecCs
|dS)zXDoes nothing.

        One supposes the response indicates the server is alive.
        ZNOOP)r7)rrrrnoopsz	POP3.noopcCs
|dS)z(Unmark all messages marked for deletion.ZRSET)r7)rrrrrset
sz	POP3.rsetcCs|d}||S)zDSignoff: commit changes on server, unlock mailbox, close connection.ZQUIT)r7close)rr1rrrquits
z	POP3.quitcCsz |j}d|_|dk	r|Wd|j}d|_|dk	rzVy|tjWn@tk
r}z"|jtjkrxt	|dddkrxWdd}~XYnXWd|XXdS)z8Close the connection without assuming anything about it.NZwinerrorri&')
rrGrZshutdownrZ	SHUT_RDWROSErrorerrnoZENOTCONNgetattr)rrrexcrrrrGsz
POP3.closecCs|d|S)zNot sure what this does.zRPOP %s)r7)rr<rrrrpop4sz	POP3.rpops\+OK.[^<]*(<.*>)cCs\t||j}|j|j}|s&tdddl}|d|}||	}|
d||fS)aAuthorisation

        - only possible if server has supplied a timestamp in initial greeting.

        Args:
                user     - mailbox user;
                password - mailbox password.

        NB: mailbox is locked by server from here to 'quit()'
        z!-ERR APOP not supported by serverrNrz
APOP %s %s)r!r"	timestampmatchrrhashlibgroupZmd5Z	hexdigestr7)rr<ZpasswordZsecretmrPZdigestrrrapop;sz	POP3.apopcCs|d||fS)zRetrieve message header of message number 'which'
        and first 'howmuch' lines of message body.

        Result is in form ['response', ['line', ...], octets].
        z	TOP %s %s)r8)rrBZhowmuchrrrtopPszPOP3.topcCs |dk	r|d|S|dS)zReturn message digest (unique id) list.

        If 'which', result contains unique id for that message
        in the form 'response mesgnum uid', otherwise result is
        the list ['response', ['mesgnum uid', ...], octets]
        NzUIDL %sZUIDL)r7r8)rrBrrruidlYsz	POP3.uidlcCs
|dS)zITry to enter UTF-8 mode (see RFC 6856). Returns server response.
        ZUTF8)r7)rrrrutf8esz	POP3.utf8c	
Cstdd}i}y8|d}|d}x |D]}||\}}|||<q&WWn*tk
rn}ztdWdd}~XYnX|S)aReturn server capabilities (RFC 2449) as a dictionary
        >>> c=poplib.POP3('localhost')
        >>> c.capa()
        {'IMPLEMENTATION': ['Cyrus', 'POP3', 'server', 'v2.2.12'],
         'TOP': [], 'LOGIN-DELAY': ['0'], 'AUTH-RESP-CODE': [],
         'EXPIRE': ['NEVER'], 'USER': [], 'STLS': [], 'PIPELINING': [],
         'UIDL': [], 'RESP-CODES': []}
        >>>

        Really, according to RFC 2449, the cyrus folks should avoid
        having the implementation split into multiple arguments...
        cSs"|d}|d|ddfS)Nasciirr)decoder?)rZlstrrr	_parsecapxszPOP3.capa.<locals>._parsecapZCAPArz!-ERR CAPA not supported by serverN)r8r)	rrYcapsr1ZrawcapsZcaplineZcapnmZcapargsZ_errrrrcapaks


z	POP3.capacCsxtstd|jrtd|}d|kr2td|dkrBt}|d}|j|j|j	d|_|j
d|_d|_|S)	z{Start a TLS session on the active connection as specified in RFC 2595.

                context - a ssl.SSLContext
        z-ERR TLS support missingz$-ERR TLS session already establishedZSTLSz!-ERR STLS not supported by serverN)server_hostnamerT)HAVE_SSLrrr[ssl_create_stdlib_contextr7wrap_socketrr
rr)rcontextrZr1rrrstlss
z	POP3.stls)N)N)N)'rrr__doc__r"	POP3_PORTr_GLOBAL_DEFAULT_TIMEOUTrrr r&r.rr6r7r8r9r;r<r=rAr5rCrDrErFrHrGrMr#compilerNrSrTrUrVr[rbrrrrr2s@+	



	
c@s8eZdZdZeddejdfddZddZd	ddZ	dS)
POP3_SSLaPOP3 client class over SSL connection

        Instantiate with: POP3_SSL(hostname, port=995, keyfile=None, certfile=None,
                                   context=None)

               hostname - the hostname of the pop3 over ssl server
               port - port number
               keyfile - PEM formatted file that contains your private key
               certfile - PEM formatted certificate chain file
               context - a ssl.SSLContext

        See the methods of the parent class POP3 for more documentation.
        NcCs|dk	r|dk	rtd|dk	r0|dk	r0td|dk	s@|dk	rVddl}|dtd||_||_|dkrxtj||d}||_t	
||||dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadr>)certfilekeyfile)r%warningswarnDeprecationWarningrirhr^r_rarr)rr
rrirhrrarjrrrrszPOP3_SSL.__init__cCs"t||}|jj||jd}|S)N)r\)rrrar`r
)rrrrrrrs
zPOP3_SSL._create_socketcCstddS)zThe method unconditionally raises an exception since the
            STLS command doesn't make any sense on an already established
            SSL/TLS session.
            z$-ERR TLS session already establishedN)r)rrirhrarrrrbsz
POP3_SSL.stls)NNN)
rrrrc
POP3_SSL_PORTrrerrrbrrrrrgs

rg__main__rr>zMessage %d:z   z-----------------------)'rcrJr#rr^r]ImportError__all__	Exceptionrrdrmr,ZLFrr*rrgr4rsysargvarr9r<r=r5rAZnumMsgsZ	totalSizerangeirCheadermsgr-rrHrrrr<module>sJ
n0