KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21571/root/usr/lib64/python2.4/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21571/root/usr/lib64/python2.4/nntplib.pyc
m
=5Dc@sdZdkZdkZdddddddd	d
ddgZd
efdYZdefdYZdefdYZdefdYZdefdYZ	defdYZ
eZeZeZ
e	Ze
ZdZdddddddddg	ZdZdfdYZed jodkZd!oeid"Zeid#d$jo
d%ZneZeed%eZeid&\ZZZZ Z!eGHd'Ge!Gd(GeGd)GeGd*Ge GHei"d+ed,e \ZZ#eGHxe#D]Z$d-e$GHqWei%ZeGHndS(.sHAn NNTP client class based on RFC 977: Network News Transfer Protocol.

Example:

>>> from nntplib import NNTP
>>> s = NNTP('news')
>>> resp, count, first, last, name = s.group('comp.lang.python')
>>> print 'Group', name, 'has', count, 'articles, range', first, 'to', last
Group comp.lang.python has 51 articles, range 5770 to 5821
>>> resp, subs = s.xhdr('subject', first + '-' + last)
>>> resp = s.quit()
>>>

Here 'resp' is the server response line.
Error responses are turned into exceptions.

To post an article from a file:
>>> f = open(filename, 'r') # file containing article, including header
>>> resp = s.post(f)
>>>

For descriptions of all methods, read the comments in the code below.
Note that all arguments and return values representing article numbers
are strings, not numbers, since they are rarely used for calculations.
NtNNTPtNNTPReplyErrortNNTPTemporaryErrortNNTPPermanentErrortNNTPProtocolErrort
NNTPDataErrorterror_replyt
error_tempt
error_permterror_protot
error_datat	NNTPErrorcBstZdZdZRS(s%Base class for all nntplib exceptionscGsDti||y|d|_Wntj
od|_nXdS(NisNo response given(t	Exceptiont__init__tselftargstresponset
IndexError(RR((t/usr/lib64/python2.4/nntplib.pyR
+s
(t__name__t
__module__t__doc__R
(((RR)scBstZdZRS(sUnexpected [123]xx reply(RRR(((RR2scBstZdZRS(s
4xx errors(RRR(((RR6scBstZdZRS(s
5xx errors(RRR(((RR:scBstZdZRS(s"Response does not begin with [1-5](RRR(((RR>scBstZdZRS(sError in response data(RRR(((RRBsiwt100t215t220t221t222t224t230t231t282s
cBsytZedddedZdZdZeZdZ	dZ
dZdZddZ
d	Zdd
ZddZddZdd
ZdZdZdZddZdZdZdZdZdZddZdZddZdZdZ ddZ!ddZ"ddZ#dZ$d Z%d!Z&d"Z'd#Z(RS($Nc
Cs||_||_tititi|_|ii|i|if|iid|_	d|_
|i|_d}|oly|id|_Wqtj
oqtj
o1}|o|id djo
d}qqXnyZ|oO|oGdk}|i}|i|}	|	o|	d}|	d}qHnWntj
onX|o|id	|}
|
d d
joO|pt|
q|id|}
|
d djot|
qn|o0y|id|_Wqtj
oqXqndS(
smInitialize an instance.  Arguments:
        - host: hostname to connect to
        - port: port to connect to (default the standard NNTP port)
        - user: username to authenticate with
        - password: password to use with username
        - readermode: if true, send 'mode reader' command after
                      connecting.

        readermode is sometimes necessary if you are connecting to an
        NNTP server on the local machine and intend to call
        reader-specific comamnds, such as `group'.  If you get
        unexpected NNTPPermanentErrors, you might need to set
        readermode.
        trbismode readerit480iNisauthinfo user t381sauthinfo pass t281(thostRtporttsockettAF_INETtSOCK_STREAMtsocktconnecttmakefiletfilet	debuggingtgetresptwelcometreadermode_afterautht
readermodetshortcmdRRtetuserRtusenetrctnetrctcredentialstauthenticatorstauthtpasswordtIOErrortrespR(
RR#R$R3R9R0R4R2R5R8R;R6R/((RR
^sR			
	
cCs'|iodGt|iGHn|iS(sGet the welcome message from the server
        (this is read and squirreled away by __init__()).
        If the response code is 200, posting is allowed;
        if it 201, posting is not allowed.s	*welcome*N(RR,treprR.(R((Rt
getwelcomes
cCs
||_dS(sSet the debugging level.  Argument 'level' means:
        0: no debugging output (default)
        1: print commands and responses but not body text etc.
        2: also print raw lines read and sent before stripping CR/LFN(tlevelRR,(RR>((Rtset_debuglevelscCsA|t}|idjodGt|GHn|ii|dS(s6Internal: send one line to the server, appending CRLF.is*put*N(tlinetCRLFRR,R<R(tsendall(RR@((Rtputlines

cCs.|iodGt|GHn|i|dS(s=Internal: send one command to the server (through putline()).s*cmd*N(RR,R<R@RC(RR@((Rtputcmds
cCs|ii}|idjodGt|GHn|p
tn|dtjo|d }n |dtjo|d }n|S(snInternal: return one line from the server, stripping CRLF.
        Raise EOFError if the connection is closed.is*get*iiN(RR+treadlineR@R,R<tEOFErrorRA(RR@((Rtgetlines
cCs|i}|iodGt|GHn|d }|djot|n|djot|n|djot|n|S(sjInternal: get a response from the server.
        Raise various errors if the response indicates an error.s*resp*it4t5t123N(	RRGR;R,R<tcRRR(RRKR;((RR-s




cCsd}zt|tot|d}}n|i}|d t	jot
|ng}xk|i}|djoPn|d djo|d}n|o|i|dqf|i|qfWWd|o|inX||fS(	s~Internal: get a response plus following text from the server.
        Raise various errors if the response indicates an error.twiit.is..s
N(tNonet
openedFilet
isinstanceR+tstrtopenRR-R;tLONGRESPRtlistRGR@twritetappendtclose(RR+RTROR@R;((Rtgetlongresps.
cCs|i||iS(s.Internal: send a command and get the response.N(RRDR@R-(RR@((RR1s
cCs|i||i|S(sBInternal: send a command and get the response plus following text.N(RRDR@RXR+(RR@R+((Rtlongcmds
cCs|id|d||S(sProcess a NEWGROUPS command.  Arguments:
        - date: string 'yymmdd' indicating the date
        - time: string 'hhmmss' indicating the time
        Return:
        - resp: server response if successful
        - list: list of newsgroup namess
NEWGROUPS t N(RRYtdatettimeR+(RR[R\R+((Rt	newgroupsscCs*d|d|d|}|i||S(sProcess a NEWNEWS command.  Arguments:
        - group: group name or '*'
        - date: string 'yymmdd' indicating the date
        - time: string 'hhmmss' indicating the time
        Return:
        - resp: server response if successful
        - list: list of message idssNEWNEWS RZN(tgroupR[R\tcmdRRYR+(RR^R[R\R+R_((RtnewnewsscCsY|id|\}}x4tt|D] }t||i	||<q+W||fS(sProcess a LIST command.  Return:
        - resp: server response if successful
        - list: list of (group, last, first, flag) (strings)tLISTN(
RRYR+R;RTtrangetlentittupletsplit(RR+RdRTR;((RRT!scCs@|i|\}}t|djodSn
|ddSdS(sGet a description for a single group.  If more than one
        group matches ('group' is a pattern), return the first.  If no
        group matches, return an empty string.

        This elides the response code from the server, since it can
        only be '215' or '285' (for xgtitle) anyway.  If the response
        code is needed, use the 'descriptions' method.

        NOTE: This neither checks for a wildcard in 'group' nor does
        it check whether the group actually exists.itiN(RtdescriptionsR^R;tlinesRc(RR^RiR;((Rtdescription,s
cCstid}|id|\}}|d djo|id|\}}ng}xG|D]?}|i
|i}|o|i
|iddqcqcW||fS(	s'Get descriptions for a range of groups.s^(?P<group>[^ 	]+)[ 	]+(.*)$sLIST NEWSGROUPS iRsXGTITLE iiN(tretcompiletline_patRRYt
group_patternR;t	raw_linesRitraw_linetsearchtstriptmatchRVR^(RRnRmRoRiRpR;Rs((RRh?s!cCs|id|}|d djot|n|i}d}}}t
|}|djoe|d}|djoJ|d}|djo/|d}|djo|di}qqqn|||||fS(	s*Process a GROUP command.  Argument:
        - group: the group name
        Returns:
        - resp: server response if successful
        - count: number of articles (string)
        - first: first article number (string)
        - last: last article number (string)
        - name: the group namesGROUP it211iiiiN(
RR1tnameR;RRftwordstcounttfirsttlastRctntlower(RRuRwRyRzRvR;Rx((RR^Ps 






 cCs|id|S(soProcess a HELP command.  Returns:
        - resp: server response if successful
        - list: list of stringstHELPN(RRYR+(RR+((RthelpjscCs|d djot|n|i}d}d}t|}|djo)|d}|djo|d}q{n|||fS(s=Internal: parse the response of a STAT, NEXT or LAST command.it22iRgiN(R;RRfRvtnrtidRcRz(RR;RzRvRR((Rt	statparseqs


cCs|i|}|i|S(s/Internal: process a STAT, NEXT or LAST command.N(RR1R@R;R(RR@R;((RtstatcmdscCs|id|S(sProcess a STAT command.  Argument:
        - id: article number or message id
        Returns:
        - resp: server response if successful
        - nr:   the article number
        - id:   the message idsSTAT N(RRR(RR((RtstatscCs
|idS(s;Process a NEXT command.  No arguments.  Return as for STAT.tNEXTN(RR(R((RtnextscCs
|idS(s;Process a LAST command.  No arguments.  Return as for STAT.tLASTN(RR(R((RRyscCs@|i||\}}|i|\}}}||||fS(s2Internal: process a HEAD, BODY or ARTICLE command.N(	RRYR@R+R;RTRRR(RR@R+R;RTRR((RtartcmdscCs|id|S(sProcess a HEAD command.  Argument:
        - id: article number or message id
        Returns:
        - resp: server response if successful
        - nr: article number
        - id: message id
        - list: the lines of the article's headersHEAD N(RRR(RR((RtheadscCs|id||S(skProcess a BODY command.  Argument:
        - id: article number or message id
        - file: Filename string or file object to store the article in
        Returns:
        - resp: server response if successful
        - nr: article number
        - id: message id
        - list: the lines of the article's body or an empty list
                if file was usedsBODY N(RRRR+(RRR+((Rtbodys	cCs|id|S(sProcess an ARTICLE command.  Argument:
        - id: article number or message id
        Returns:
        - resp: server response if successful
        - nr: article number
        - id: message id
        - list: the lines of the articlesARTICLE N(RRR(RR((RtarticlescCs
|idS(sPProcess a SLAVE command.  Returns:
        - resp: server response if successfultSLAVEN(RR1(R((Rtslavesc
Cstid}|id|d||\}	}xTt
t|D]@}||}|i|}|o|idd||<qFqFW|	|fS(sProcess an XHDR command (optional server extension).  Arguments:
        - hdr: the header type (e.g. 'subject')
        - str: an article nr, a message id, or a range nr1-nr2
        Returns:
        - resp: server response if successful
        - list: list of (nr, value) stringss^([0-9]+) ?(.*)
?sXHDR RZiiN(RkRltpatRRYthdrRQR+R;RiRbRcRdR@RstmR^(
RRRQR+RRdRRiR@R;((Rtxhdrs$
c	Cs|id|d||\}}g}x|D]}|i	d}yO|i|d|d|d|d|d|d	i	|d
|dfWq1tj
ot
|q1Xq1W||fS(
s(Process an XOVER command (optional server extension) Arguments:
        - start: start of range
        - end: end of range
        Returns:
        - resp: server response if successful
        - list: list of (art-nr, subject, poster, date,
                         id, references, size, lines)sXOVER t-s	iiiiiiiiN(RRYtstarttendR+R;Ritxover_linesR@RftelemRVRR(	RRRR+RiRRR@R;((Rtxovers$Oc	Cstid}|id||\}}g}xG|D]?}|i|i}|o|i|iddq8q8W||fS(sProcess an XGTITLE command (optional server extension) Arguments:
        - group: group name wildcard (i.e. news.*)
        Returns:
        - resp: server response if successful
        - list: list of (name,title) stringss^([^ 	]+)[ 	]+(.*)$sXGTITLE iiN(RkRlRmRRYR^R+R;RoRiRpRqRrRsRV(	RR^R+RmRoRiRpR;Rs((Rtxgtitles!cCsz|id|}|d djot|ny|i\}}Wntj
ot|nX||fSdS(sProcess an XPATH command (optional server extension) Arguments:
        - id: Message id of article
        Returns:
        resp: server response if successful
        path: directory path to articlesXPATH it223N(	RR1RR;RRftresp_numtpatht
ValueError(RRR;RR((RtxpathscCs|id}|d djot|n|i}t|djot|n|ddd!}|dd}t|djpt|djot|n|||fS(
sProcess the DATE command. Arguments:
        None
        Returns:
        resp: server response if successful
        date: Date suitable for newnews/newgroups commands etc.
        time: Time suitable for newnews/newgroups commands etc.tDATEit111iiiiiN(
RR1R;RRfRRcRR[R\(RRR\R[R;((RR[s&cCs|id}|ddjot|nxh|i}|pPn|ddjo|d }n|d djod|}n|i|q3W|id|iS(	sProcess a POST command.  Arguments:
        - f: file containing the article
        Returns:
        - resp: server response if successfultPOSTit3iis
RMN(	RR1R;RtfRER@RCR-(RRR@R;((Rtpost&s 
cCs|id|}|ddjot|nxh|i}|pPn|ddjo|d }n|d djod|}n|i|q7W|id|i	S(	sProcess an IHAVE command.  Arguments:
        - id: message-id of the article
        - f:  file containing the article
        Returns:
        - resp: server response if successful
        Note that if the server refuses the article an exception is raised.sIHAVE iRiis
RMN(
RR1RR;RRRER@RCR-(RRRR;R@((Rtihave<s 
cCs9|id}|ii|ii|`|`|S(sdProcess a QUIT command and close the socket.  Returns:
        - resp: server response if successfultQUITN(RR1R;R+RWR((RR;((RtquitTs

()RRt	NNTP_PORTRNtTrueR
R=R?tdebugRCRDRGR-RXR1RYR]R`RTRjRhR^R}RRRRRyRRRRRRRRRR[RRR(((RR]sHN								
						
			
						t__main__tnewst
NNTPSERVERRMiR0scomp.lang.pythontGroupthassarticles, rangettotsubjectRs%7s %s(&RRkR%t__all__RRRRRRRRRRR	R
RRSRARRtostenvirontnewshosttfindtmodeRNtsR^R;RwRxRyRuRtsubstitemR(RRRR;R
RRRSRkRRRRRRARuRwRRyR%R	RRRRRRRRx((Rt?sJ		'	!	
	
! 


Anon7 - 2021