Network News
Network News, also known as Usenet News, is
mostly transmitted with the Network News Transport Protocol (NNTP).
The Python standard library supports this protocol in its module
nntplib. The nntplib module
supplies a class NNTP to connect to an NNTP
server.
Reference Section
Response Strings
An instance
n of NNTP supplies many
methods. Each of n’s
methods returns a tuple whose first item is a string (referred to as
response in the following section) that is
the response from the NNTP server to the NNTP command corresponding
to the method (method post just returns the
response string, not a tuple). Each method
returns the response string just as the
NNTP server supplies it. The string starts with an integer in decimal
form (the integer is known as the return code), followed by a space,
followed by more text.
For some commands, the extra text after the return code is just a comment or explanation supplied by the NNTP server. For other commands, the NNTP standard specifies the format of the text that follows the return code on the response line. In those cases, the relevant method also parses the text in question, yielding other items in the method’s resulting tuple, so your code need not perform such parsing itself; rather, you can just access further items in the method’s result tuple, as specified in the following sections.
Return codes of the form
2
xx, for any two digits
xx, are success codes (i.e., they indicate that the corresponding NNTP command succeeded). Return ...