PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` ryMa"c@s(dZddlZddlZddlZddlZddlZyddlZWnek rleZ YnXe Z ddl m Z ddlmZddddd d d gZd ZGd ddeZGdddeZGdddeZGdddeZGdd d eZGdd d eZdZdZddddddddddd d!h Zd"d#d$d%d&d'd(gZid'd)6d(d*6Zd+Zejd,d-d.d/d0gZejd1d2d3d*gZ d4d Z d5d6Z!e"d7d8Z#e"d9d:Z$ed;d<Z%e r6d=d>Z&nGd?d@d@Z'GdAdde'Z(e rGdBdCdCe'Z)ej*dCne+dDkr$ddl,Z,ddEl-m.Z.e,j/dFdGZ0e0j1dHdIdJdKdLdMe0j1dNdOdJdPdLdQe0j1dRdSdJdT dUe2dLdVeefe0j1dWdXdJdYdUe2dLdZe0j1d[d\d]d^dJedLd_e0j3Z4e4j5Z5e4j re5dT kreZ5ne(d`e4j6dae5Z7n.e5dT kreZ5ne)d`e4j6dae5Z7e7j8Z9dbe9kre7j:ne7j;e4j;\Z<Z=Z>Z?Z@eAdce@dde=dee>dfe?dgdhZBeCe2e?e4jDdTZ>e7jEe>e?\Z<ZFxeFD]z\ZGZHe eHd#jIdidTdZJe eHd"ZKe2eHd(ZLeAdjjMeGeBeJdkeBeKdleLqWe7jNndS(muAn NNTP client class based on: - RFC 977: Network News Transfer Protocol - RFC 2980: Common NNTP Extensions - RFC 3977: Network News Transfer Protocol (version 2) 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', '{0}-{1}'.format(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, 'rb') # 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. iN(u decode_header(u_GLOBAL_DEFAULT_TIMEOUTuNNTPuNNTPReplyErroruNNTPTemporaryErroruNNTPPermanentErroruNNTPProtocolErroru NNTPDataErroru decode_headericBs&|EeZdZdZddZdS(u NNTPErroru%Base class for all nntplib exceptionsc GsCtj||y|d|_Wntk r>d|_YnXdS(NiuNo response given(u Exceptionu__init__uresponseu IndexError(uselfuargs((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu__init__bs  uNNTPError.__init__N(u__name__u __module__u __qualname__u__doc__u__init__(u __locals__((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu NNTPError`su NNTPErrorcBs|EeZdZdZdS(uNNTPReplyErroruUnexpected [123]xx replyN(u__name__u __module__u __qualname__u__doc__(u __locals__((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuNNTPReplyErroriscBs|EeZdZdZdS(uNNTPTemporaryErroru 4xx errorsN(u__name__u __module__u __qualname__u__doc__(u __locals__((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuNNTPTemporaryErrormscBs|EeZdZdZdS(uNNTPPermanentErroru 5xx errorsN(u__name__u __module__u __qualname__u__doc__(u __locals__((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuNNTPPermanentErrorqscBs|EeZdZdZdS(uNNTPProtocolErroru"Response does not begin with [1-5]N(u__name__u __module__u __qualname__u__doc__(u __locals__((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuNNTPProtocolErroruscBs|EeZdZdZdS(u NNTPDataErroruError in response dataN(u__name__u __module__u __qualname__u__doc__(u __locals__((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu NNTPDataErrorysiwi3u100u101u211u215u220u221u222u224u225u230u231u282usubjectufromudateu message-idu referencesu:bytesu:linesubytesuliness u GroupInfougroupulastufirstuflagu ArticleInfounumberu message_idcCskg}xUt|D]G\}}t|trM|j|j|pCdq|j|qWdj|S(uwTakes an unicode string representing a munged header value and decodes it as a (possibly non-ASCII) readable value.uasciiu(u_email_decode_headeru isinstanceubytesuappendudecodeujoin(u header_strupartsuvuenc((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu decode_headers cCsg}x|D]}|ddkrR|ddjd\}}}d|}n|jd\}}}|j}tj||}|j|q Wt}t|t|krtdn|dt||krtdn|S(uParse a list of string representing the response to LIST OVERVIEW.FMT and return a list of header/metadata names. Raises NNTPDataError if the response is not compliant (cf. RFC 3977, section 8.4).iu:iNu$LIST OVERVIEW.FMT response too shortu*LIST OVERVIEW.FMT redefines default fields(u partitionuloweru_OVERVIEW_FMT_ALTERNATIVESugetuappendu_DEFAULT_OVERVIEW_FMTulenu NNTPDataError(ulinesufmtulineunameu_usuffixudefaults((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_parse_overview_fmts "  u_parse_overview_fmtcCs6tt}g}x|D]}i}|jd^}}t|}xt|D]\} } | t|krwqSn|| } | jd} | |kr | r | d} | r| dt| j| krtdn| r| t| dnd} n| ||| d?Z&dfd@dAZ'd%dfdfdBdCZ(d%dfdfdDdEZ)d%dfdfdFdGZ*dHdIZ+d%dfdJdKZ,d%dfdLdMZ-d%dfdNdOZ.d%dfdPdQZ/dRdSZ0dTdUZ1dVdWZ2dXdYZ3dZd[Z4d\d]Z5d^d_Z6dfdfdgd`daZ7dbdcZ8e9rdfdddeZ:ndfS(hu _NNTPBaseuutf-8usurrogateescapecCs||_||_d|_|j|_d|_|jd|_ |rd|jkr|j |j sd|_|jqnd|_ d|_ dS(uSInitialize an instance. Arguments: - file: file-like object (open for read/write in binary mode) - host: hostname of the server - readermode: if true, send 'mode reader' command after connecting. - timeout: timeout (in seconds) used for socket connections readermode is sometimes necessary if you are connecting to an NNTP server on the local machine and intend to call reader-specific commands, such as `group'. If you get unexpected NNTPPermanentErrors, you might need to set readermode. iuREADERNF( uhostufileu debuggingu_getrespuwelcomeuNoneu_capsugetcapabilitiesuFalseureadermode_afterauthu_setreadermodeutls_onu authenticated(uselfufileuhostu readermodeutimeout((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu__init__:s         u_NNTPBase.__init__cCs|S(N((uself((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu __enter__isu_NNTPBase.__enter__cslfdd}|rhz0yjWntjtfk rIYnXWd|rdjnXndS(Ncs tdS(Nufile(uhasattr((uself(u,/opt/alt/python33/lib64/python3.3/nntplib.pyumsu$_NNTPBase.__exit__..(uquitusocketuerroruEOFErroru_close(uselfuargsu is_connected((uselfu,/opt/alt/python33/lib64/python3.3/nntplib.pyu__exit__ls   u_NNTPBase.__exit__cCs)|jr"tdt|jn|jS(uGet 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.u *welcome*(u debugginguprinturepruwelcome(uself((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu getwelcomews u_NNTPBase.getwelcomec Cs|jdkrd|_d|_y|j\}}Wn!ttfk rZi|_YqX||_d|krttt |d|_nd|krdj |d|_qn|jS(uGet the server capabilities, as read by __init__(). If the CAPABILITIES command is not supported, an empty dict is returned.iuVERSIONuIMPLEMENTATIONu N( u_capsuNoneu nntp_versionunntp_implementationu capabilitiesuNNTPPermanentErroruNNTPTemporaryErrorumaxumapuintujoin(uselfurespucaps((u,/opt/alt/python33/lib64/python3.3/nntplib.pyugetcapabilitiess     u_NNTPBase.getcapabilitiescCs ||_dS(uSet 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(u debugging(uselfulevel((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuset_debuglevelsu_NNTPBase.set_debuglevelcCsP|t}|jdkr/tdt|n|jj||jjdS(ufInternal: send one line to the server, appending CRLF. The `line` must be a bytes-like object.iu*put*N(u_CRLFu debugginguprintureprufileuwriteuflush(uselfuline((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_putlines  u_NNTPBase._putlinecCsH|jrtdt|n|j|j|j}|j|dS(ulInternal: send one command to the server (through _putline()). The `line` must be an unicode string.u*cmd*N(u debugginguprinturepruencodeuencodinguerrorsu_putline(uselfuline((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_putcmds u_NNTPBase._putcmdcCs|jjtd}t|tkr7tdn|jdkr\tdt|n|sktn|r|ddt kr|dd}q|ddt kr|dd }qn|S( uInternal: return one line from the server, stripping _CRLF. Raise EOFError if the connection is closed. Returns a bytes object.iu line too longu*get*iNiiii( ufileureadlineu_MAXLINEulenu NNTPDataErroru debugginguprinturepruEOFErroru_CRLF(uselfu strip_crlfuline((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_getlines u_NNTPBase._getlinecCs|j}|jr+tdt|n|j|j|j}|dd}|dkrnt|n|dkrt|n|dkrt |n|S(uInternal: get a response from the server. Raise various errors if the response indicates an error. Returns an unicode string.u*resp*Niu4u5u123( u_getlineu debugginguprintureprudecodeuencodinguerrorsuNNTPTemporaryErroruNNTPPermanentErroruNNTPProtocolError(uselfurespuc((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_getresps     u_NNTPBase._getrespc CsWd}z0t|ttfr4t|d}}n|j}|ddtkret|ng}|dk rdtdf}x|j d}||krPn|j dr|dd}n|j |qnWd}xN|j }||krPn|j dr%|dd}n|j |qWd|rL|jnX||fS( uQInternal: get a response plus following text from the server. Raise various errors if the response indicates an error. Returns a (response, lines) tuple where `response` is an unicode string and `lines` is a list of bytes objects. If `file` is a file-like object, it must be open in binary mode. uwbNis.s. s..iF(uNoneu isinstanceustrubytesuopenu_getrespu _LONGRESPuNNTPReplyErroru_CRLFu_getlineuFalseu startswithuwriteuappenduclose(uselfufileu openedFileurespulinesu terminatorsulineu terminator((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu _getlongresps8      u_NNTPBase._getlongrespcCs|j||jS(uWInternal: send a command and get the response. Same return value as _getresp().(u_putcmdu_getresp(uselfuline((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu _shortcmds u_NNTPBase._shortcmdcCs|j||j|S(uoInternal: send a command and get the response plus following text. Same return value as _getlongresp().(u_putcmdu _getlongresp(uselfulineufile((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_longcmds u_NNTPBase._longcmdcs?j|j|\}}|fdd|DfS(uInternal: send a command and get the response plus following text. Same as _longcmd() and _getlongresp(), except that the returned `lines` are unicode strings rather than bytes objects. cs(g|]}|jjjqS((udecodeuencodinguerrors(u.0uline(uself(u,/opt/alt/python33/lib64/python3.3/nntplib.pyu s u,_NNTPBase._longcmdstring..(u_putcmdu _getlongresp(uselfulineufileurespulist((uselfu,/opt/alt/python33/lib64/python3.3/nntplib.pyu_longcmdstring s u_NNTPBase._longcmdstringcCswy |jSWntk rYnXy|jd\}}Wn"tk r]tdd}Yn Xt|}||_|S(uqInternal: get the overview format. Queries the server if not already done, else returns the cached value.uLIST OVERVIEW.FMTN(u_cachedoverviewfmtuAttributeErroru_longcmdstringuNNTPPermanentErroru_DEFAULT_OVERVIEW_FMTu_parse_overview_fmt(uselfurespulinesufmt((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_getoverviewfmts     u_NNTPBase._getoverviewfmtcCsdd|DS(NcSs"g|]}t|jqS((u GroupInfousplit(u.0uline((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu &s u(_NNTPBase._grouplist..((uselfulines((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu _grouplist$su_NNTPBase._grouplistcCsRi}|jd\}}x*|D]"}|j^}}|||[^ ]+)[ ]+(.*)$uLIST NEWSGROUPS u215uXGTITLE iiu(ureucompileu_longcmdstringu startswithusearchustripugroup( uselfu group_patternu return_alluline_paturespulinesugroupsuraw_lineumatchunameudesc((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_getdescriptionses  u_NNTPBase._getdescriptionscCs|j|dS(uGet 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.F(u_getdescriptionsuFalse(uselfugroup((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu description|s u_NNTPBase.descriptioncCs|j|dS(u'Get descriptions for a range of groups.T(u_getdescriptionsuTrue(uselfu group_pattern((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu descriptionssu_NNTPBase.descriptionscCs|jd|}|jds1t|n|j}d}}}t|}|dkr|d}|dkr|d}|dkr|d}|dkr|dj}qqqn|t|t|t||fS(uProcess a GROUP command. Argument: - group: the group name Returns: - resp: server response if successful - count: number of articles - first: first article number - last: last article number - name: the group name uGROUP u211iiiii(u _shortcmdu startswithuNNTPReplyErrorusplitulenuloweruint(uselfunameurespuwordsucountufirstulastun((u,/opt/alt/python33/lib64/python3.3/nntplib.pyugroups          u_NNTPBase.groupcCs|jd|S(uProcess a HELP command. Argument: - file: Filename string or file object to store the result in Returns: - resp: server response if successful - list: list of strings returned by the server in response to the HELP command uHELP(u_longcmdstring(uselfufile((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuhelpsu_NNTPBase.helpcCsQ|jdst|n|j}t|d}|d}|||fS(u_Internal: parse the response line of a STAT, NEXT, LAST, ARTICLE, HEAD or BODY command.u22ii(u startswithuNNTPReplyErrorusplituint(uselfurespuwordsuart_numu message_id((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu _statparses   u_NNTPBase._statparsecCs|j|}|j|S(u/Internal: process a STAT, NEXT or LAST command.(u _shortcmdu _statparse(uselfulineuresp((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_statcmdsu_NNTPBase._statcmdcCs-|r|jdj|S|jdSdS(u(Process a STAT command. Argument: - message_spec: article number or message id (if not specified, the current article is selected) Returns: - resp: server response if successful - art_num: the article number - message_id: the message id uSTAT {0}uSTATN(u_statcmduformat(uselfu message_spec((u,/opt/alt/python33/lib64/python3.3/nntplib.pyustats u_NNTPBase.statcCs |jdS(u;Process a NEXT command. No arguments. Return as for STAT.uNEXT(u_statcmd(uself((u,/opt/alt/python33/lib64/python3.3/nntplib.pyunextsu_NNTPBase.nextcCs |jdS(u;Process a LAST command. No arguments. Return as for STAT.uLAST(u_statcmd(uself((u,/opt/alt/python33/lib64/python3.3/nntplib.pyulastsu_NNTPBase.lastcCsF|j||\}}|j|\}}}|t|||fS(u2Internal: process a HEAD, BODY or ARTICLE command.(u_longcmdu _statparseu ArticleInfo(uselfulineufileurespulinesuart_numu message_id((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_artcmdsu_NNTPBase._artcmdcCs4|dk rdj|}nd}|j||S(u0Process a HEAD command. Argument: - message_spec: article number or message id - file: filename string or file object to store the headers in Returns: - resp: server response if successful - ArticleInfo: (article number, message id, list of header lines) uHEAD {0}uHEADN(uNoneuformatu_artcmd(uselfu message_specufileucmd((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuheads u_NNTPBase.headcCs4|dk rdj|}nd}|j||S(u+Process a BODY command. Argument: - message_spec: article number or message id - file: filename string or file object to store the body in Returns: - resp: server response if successful - ArticleInfo: (article number, message id, list of body lines) uBODY {0}uBODYN(uNoneuformatu_artcmd(uselfu message_specufileucmd((u,/opt/alt/python33/lib64/python3.3/nntplib.pyubodys u_NNTPBase.bodycCs4|dk rdj|}nd}|j||S(u5Process an ARTICLE command. Argument: - message_spec: article number or message id - file: filename string or file object to store the article in Returns: - resp: server response if successful - ArticleInfo: (article number, message id, list of article lines) u ARTICLE {0}uARTICLEN(uNoneuformatu_artcmd(uselfu message_specufileucmd((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuarticles u_NNTPBase.articlecCs |jdS(uYProcess a SLAVE command. Returns: - resp: server response if successful uSLAVE(u _shortcmd(uself((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuslavesu_NNTPBase.slavecsbtjd|jdj|||\}}fdd|fdd|DfS(uiProcess 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 - file: Filename string or file object to store the result in Returns: - resp: server response if successful - list: list of (nr, value) strings u^([0-9]+) ?(.*) ?u XHDR {0} {1}cs)j|}|r%|jddS|S(Nii(umatchugroup(ulineum(upat(u,/opt/alt/python33/lib64/python3.3/nntplib.pyu remove_numbersu%_NNTPBase.xhdr..remove_numbercsg|]}|qS(((u.0uline(u remove_number(u,/opt/alt/python33/lib64/python3.3/nntplib.pyu s u"_NNTPBase.xhdr..(ureucompileu_longcmdstringuformat(uselfuhdrustrufileurespulines((upatu remove_numberu,/opt/alt/python33/lib64/python3.3/nntplib.pyuxhdr s $u_NNTPBase.xhdrcCsC|jdj|||\}}|j}|t||fS(uFProcess an XOVER command (optional server extension) Arguments: - start: start of range - end: end of range - file: Filename string or file object to store the result in Returns: - resp: server response if successful - list: list of dicts containing the response fields u XOVER {0}-{1}(u_longcmdstringuformatu_getoverviewfmtu_parse_overview(uselfustartuendufileurespulinesufmt((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuxovers  u_NNTPBase.xoverc Csd|jkrdnd}t|ttfr[|\}}|dj||pQd7}n|dk rx|d|}n|j||\}}|j}|t||fS(uProcess an OVER command. If the command isn't supported, fall back to XOVER. Arguments: - message_spec: - either a message id, indicating the article to fetch information about - or a (start, end) tuple, indicating a range of article numbers; if end is None, information up to the newest message will be retrieved - or None, indicating the current article number must be used - file: Filename string or file object to store the result in Returns: - resp: server response if successful - list: list of dicts containing the response fields NOTE: the "message id" form isn't supported by XOVER uOVERuXOVERu {0}-{1}uu N( u_capsu isinstanceutupleulistuformatuNoneu_longcmdstringu_getoverviewfmtu_parse_overview( uselfu message_specufileucmdustartuendurespulinesufmt((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuover*s   u_NNTPBase.overc Cstjdtdtjd}|jd||\}}g}xE|D]=}|j|j}|rK|j|j ddqKqKW||fS(uProcess 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) stringsuFThe XGTITLE extension is not actively used, use descriptions() insteadiu^([^ ]+)[ ]+(.*)$uXGTITLE i( uwarningsuwarnuDeprecationWarningureucompileu_longcmdstringusearchustripuappendugroup( uselfugroupufileuline_paturespu raw_linesulinesuraw_lineumatch((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuxgtitleEs    u_NNTPBase.xgtitlec Cstjdtd|jdj|}|jdsIt|ny|j\}}Wntk rt|Yn X||fSdS(uProcess an XPATH command (optional server extension) Arguments: - id: Message id of article Returns: resp: server response if successful path: directory path to article u(The XPATH extension is not actively usediu XPATH {0}u223N( uwarningsuwarnuDeprecationWarningu _shortcmduformatu startswithuNNTPReplyErrorusplitu ValueError(uselfuidurespuresp_numupath((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuxpathWs   u_NNTPBase.xpathcCs|jd}|jds-t|n|j}t|dkrZt|n|d}t|dkrt|n|t|dfS(uProcess the DATE command. Returns: - resp: server response if successful - date: datetime object uDATEu111iiiN(u _shortcmdu startswithuNNTPReplyErrorusplitulenu NNTPDataErroru_parse_datetimeuNone(uselfurespuelemudate((u,/opt/alt/python33/lib64/python3.3/nntplib.pyudateks  u_NNTPBase.datecCs|j|}|jds-t|nt|ttfrQ|j}nx_|D]W}|jts|j dt}n|jdrd|}n|j j |qXW|j j d|j j |j S(Nu3s s.s. (u _shortcmdu startswithuNNTPReplyErroru isinstanceubytesu bytearrayu splitlinesuendswithu_CRLFurstripufileuwriteuflushu_getresp(uselfucommandufurespuline((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_post|s   u_NNTPBase._postcCs|jd|S(uProcess a POST command. Arguments: - data: bytes object, iterable or file containing the article Returns: - resp: server response if successfuluPOST(u_post(uselfudata((u,/opt/alt/python33/lib64/python3.3/nntplib.pyupostsu_NNTPBase.postcCs|jdj||S(u Process an IHAVE command. Arguments: - message_id: message-id of the article - data: file containing the article Returns: - resp: server response if successful Note that if the server refuses the article an exception is raised.u IHAVE {0}(u_postuformat(uselfu message_idudata((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuihavesu_NNTPBase.ihavecCs|jj|`dS(N(ufileuclose(uself((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_closes u_NNTPBase._closec Cs%z|jd}Wd|jX|S(udProcess a QUIT command and close the socket. Returns: - resp: server response if successfuluQUITN(u _shortcmdu_close(uselfuresp((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuquits u_NNTPBase.quitc Csi|jrtdn| r5| r5tdny[|r| rddl}|j}|j|j}|r|d}|d}qnWntk rYnX|sdS|jd|}|jdr|st|q|jd|}|jdst |qnd|_ |j |j red |j kre|jd|_ |j ndS( NuAlready logged in.u7At least one of `user` and `usenetrc` must be specifiediiuauthinfo user u381uauthinfo pass u281uREADER(u authenticatedu ValueErrorunetrcuauthenticatorsuhostuIOErroru _shortcmdu startswithuNNTPReplyErroruNNTPPermanentErroruNoneu_capsugetcapabilitiesureadermode_afterauthu_setreadermode(uselfuuserupassworduusenetrcunetrcu credentialsuauthuresp((u,/opt/alt/python33/lib64/python3.3/nntplib.pyulogins<           u_NNTPBase.logincCsty|jd|_WnWtk r*YnFtk ro}z&|jjdrZd|_nWYdd}~XnXdS(Nu mode readeru480T(u _shortcmduwelcomeuNNTPPermanentErroruNNTPTemporaryErroruresponseu startswithuTrueureadermode_afterauth(uselfue((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_setreadermodes  u_NNTPBase._setreadermodecCs|jrtdn|jr0tdn|jd}|jdr|jjt|j||_|jj d|_d|_d|_ |j n tddS( uzProcess a STARTTLS command. Arguments: - context: SSL context to use for the encrypted connection uTLS is already enabled.u+TLS cannot be started after authentication.uSTARTTLSu382urwbuTLS failed to start.NT(utls_onu ValueErroru authenticatedu _shortcmdu startswithufileucloseu _encrypt_onusockumakefileuTrueuNoneu_capsugetcapabilitiesu NNTPError(uselfucontexturesp((u,/opt/alt/python33/lib64/python3.3/nntplib.pyustarttlss      u_NNTPBase.starttlsNT(;u__name__u __module__u __qualname__uencodinguerrorsuNoneu_GLOBAL_DEFAULT_TIMEOUTu__init__u __enter__u__exit__u getwelcomeugetcapabilitiesuset_debugleveludebugu_putlineu_putcmduTrueu_getlineu_getrespu _getlongrespu _shortcmdu_longcmdu_longcmdstringu_getoverviewfmtu _grouplistu capabilitiesu newgroupsunewnewsulistu_getdescriptionsu descriptionu descriptionsugroupuhelpu _statparseu_statcmdustatunextulastu_artcmduheadubodyuarticleuslaveuxhdruxoveruoveruxgtitleuxpathudateu_postupostuihaveu_closeuquituloginu_setreadermodeu _have_sslustarttls(u __locals__((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu _NNTPBase*sj .      .                 ) u _NNTPBasecBs>|EeZdZeddddeddZddZdS(uNNTPc Cs~||_||_tj||f||_|jjd}tj||||||sd|rz|j|||ndS(u,Initialize 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. - usenetrc: allow loading username and password from ~/.netrc file if not specified explicitly - timeout: timeout (in seconds) used for socket connections readermode is sometimes necessary if you are connecting to an NNTP server on the local machine and intend to call reader-specific commands, such as `group'. If you get unexpected NNTPPermanentErrors, you might need to set readermode. urwbN( uhostuportusocketucreate_connectionusockumakefileu _NNTPBaseu__init__ulogin( uselfuhostuportuuserupasswordu readermodeuusenetrcutimeoutufile((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu__init__s    u NNTP.__init__c Cs&ztj|Wd|jjXdS(N(u _NNTPBaseu_closeusockuclose(uself((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_closesu NNTP._closeNF( u__name__u __module__u __qualname__u NNTP_PORTuNoneuFalseu_GLOBAL_DEFAULT_TIMEOUTu__init__u_close(u __locals__((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuNNTPs c BsA|EeZdZedddddeddZddZdS(uNNTP_SSLc Cstj||f||_t|j||_|jjd} tj|| |d|d||sm|r|j|||ndS(uThis works identically to NNTP.__init__, except for the change in default port and the `ssl_context` argument for SSL connections. urwbu readermodeutimeoutN(usocketucreate_connectionusocku _encrypt_onumakefileu _NNTPBaseu__init__ulogin( uselfuhostuportuuserupasswordu ssl_contextu readermodeuusenetrcutimeoutufile((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu__init__&s  uNNTP_SSL.__init__c Cs&ztj|Wd|jjXdS(N(u _NNTPBaseu_closeusockuclose(uself((u,/opt/alt/python33/lib64/python3.3/nntplib.pyu_close5suNNTP_SSL._closeNF( u__name__u __module__u __qualname__u NNTP_SSL_PORTuNoneuFalseu_GLOBAL_DEFAULT_TIMEOUTu__init__u_close(u __locals__((u,/opt/alt/python33/lib64/python3.3/nntplib.pyuNNTP_SSL$s   uNNTP_SSLu__main__(u parsedateu descriptionuJ nntplib built-in demo - display the latest articles in a newsgroupu-gu--groupudefaultugmane.comp.python.generaluhelpu3group to fetch messages from (default: %(default)s)u-su--serverunews.gmane.orgu+NNTP server hostname (default: %(default)s)u-pu--portiutypeu#NNTP port number (default: %s / %s)u-nu --nb-articlesi u2number of articles to fetch (default: %(default)s)u-Su--ssluactionu store_trueuuse NNTP over SSLuhostuportuSTARTTLSuGroupuhasuarticles, rangeutocCs1t||kr-|d|dd}n|S(Niu...(ulen(usulim((u,/opt/alt/python33/lib64/python3.3/nntplib.pyucutasucutus&               &              !   )