3 #ˆÄÉ „d.¸ÏÈ¿Ë?÷#a ´i? ã @s>dZddlZddlZddlZddlZddlZz ddlZWneyNdZYn0dZddl m Z ddlm Z gd¢Z dZGd d „d eƒZGd d „d eƒZGd d„deƒZGdd„deƒZGdd„deƒZGdd„deƒZdZdZhd£Zgd¢ZdddœZdZe dgd¢¡Ze dgd ¢¡Zd!d"„Z d#d$„ZdZd%d&„Z d[d'd(„Z!d\d)d*„Z"e�rZd+d,„Z#Gd-d.„d.ƒZ$e�rˆGd/d0„d0e$ƒZ%e  &d0¡e'd1k�r:ddl(Z(e(j)d2d3�Z*e*j+d4d5d6d7d8�e*j+d9d:d;dd?e,d@eefdA�e*j+dBdCdDe,dEdA�e*j+dFdGdHddIdJ�e* -¡Z.e.j/Z/e.j�sBe/d?k�r2eZ/e$e.j0e/dK�Z1ne/d?k�rPeZ/e%e.j0e/dK�Z1e1 2¡Z3dLe3v�rxe1 4¡e1 5e.j5¡\Z6Z7Z8Z9Z:e;dMe:dNe7dOe8dPe9ƒdQdR„ZdSƒZ8e1 ?e8e9¡\Z6Z@e@D]Z\ZAZBe eBdTƒ CdUdS¡dZDe eBdVƒZEe,eBdƒZFe;dW GeAe>> 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. éNFT)Ú decode_header)Ú_GLOBAL_DEFAULT_TIMEOUT)ÚNNTPÚ NNTPErrorÚNNTPReplyErrorÚNNTPTemporaryErrorÚNNTPPermanentErrorÚNNTPProtocolErrorÚ NNTPDataErrorric@seZdZdZdd„ZdS)rz%Base class for all nntplib exceptionscGs>tj|g|¢RŽz|d|_Wnty8d|_Yn0dS)NrzNo response given)Ú ExceptionÚ__init__ÚresponseÚ IndexError)ÚselfÚargs©rú/usr/lib64/python3.9/nntplib.pyr bs  zNNTPError.__init__N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r rrrrr`src@seZdZdZdS)rzUnexpected [123]xx replyN©rrrrrrrrrisrc@seZdZdZdS)rz 4xx errorsNrrrrrrmsrc@seZdZdZdS)rz 5xx errorsNrrrrrrqsrc@seZdZdZdS)r z"Response does not begin with [1-5]Nrrrrrr usr c@seZdZdZdS)r zError in response dataNrrrrrr ysr éwi3> Ú211Ú215Z101Z230Z231Z225Z282Z100Z221Z222Z224Z220)ÚsubjectÚfromÚdatez message-idZ referencesú:bytesú:linesrr)ÚbytesÚlinesó Ú GroupInfo)ÚgroupÚlastÚfirstÚflagÚ ArticleInfo)ÚnumberÚ message_idr!cCsJg}t|ƒD]2\}}t|tƒr4| | |p,d¡¡q | |¡q d |¡S)zvTakes a unicode string representing a munged header value and decodes it as a (possibly non-ASCII) readable value.ÚasciiÚ)Ú_email_decode_headerÚ isinstancer ÚappendÚdecodeÚjoin)Z header_strÚpartsÚvÚencrrrr§s   rcCs¦g}|D]`}|ddkr:|dd… d¡\}}}d|}n| d¡\}}}| ¡}t ||¡}| |¡qt}t|ƒt|ƒkr†tdƒ‚|dt|ƒ…|kr¢tdƒ‚|S)zÐParse a list of string representing the response to LIST OVERVIEW.FMT and return a list of header/metadata names. Raises NNTPDataError if