NNTP instances have the following methods. The response that is returned as the first item in the return tuple of almost all methods is the server's response: a string beginning with a three-digit code. If the server's response indicates an error, the method raises one of the above exceptions.
) |
level) |
0
, produces no debugging
output. A value of 1
produces a moderate amount of debugging
output, generally a single line per request or response. A value of
2
or higher produces the maximum amount of debugging output,
logging each line sent and received on the connection (including
message text).
date, time, [file]) |
'yymmdd'
indicating the
date, and time should be a string of the form
'hhmmss'
indicating the time. Return a pair
(response, groups)
where groups is a list of
group names that are new since the given date and time.
If the file parameter is supplied, then the output of the
"NEWGROUPS" command is stored in a file. If file is a string,
then the method will open a file object with that name, write to it
then close it. If file is a file object, then it will start
calling write() on it to store the lines of the command output.
If file is supplied, then the returned list is an empty list.
group, date, time, [file]) |
'*'
, and date and time have the same meaning as for
newgroups(). Return a pair (response,
articles)
where articles is a list of article ids.
If the file parameter is supplied, then the output of the
"NEWNEWS" command is stored in a file. If file is a string,
then the method will open a file object with that name, write to it
then close it. If file is a file object, then it will start
calling write() on it to store the lines of the command output.
If file is supplied, then the returned list is an empty list.
[file]) |
(response,
list)
where list is a list of tuples. Each tuple has the
form (group, last, first, flag)
, where
group is a group name, last and first are the last
and first article numbers (as strings), and flag is
'y'
if posting is allowed, 'n'
if not, and 'm'
if
the newsgroup is moderated. (Note the ordering: last,
first.)
If the file parameter is supplied, then the output of the
"LIST" command is stored in a file. If file is a string,
then the method will open a file object with that name, write to it
then close it. If file is a file object, then it will start
calling write() on it to store the lines of the command output.
If file is supplied, then the returned list is an empty list.
grouppattern) |
(response,
list)
, where list is a list of tuples containing
(name, title)
.
New in version 2.4.
group) |
This elides the response code from the server. If the response code is needed, use descriptions().
New in version 2.4.
name) |
(response, count, first,
last, name)
where count is the (estimated) number
of articles in the group, first is the first article number in
the group, last is the last article number in the group, and
name is the group name. The numbers are returned as strings.
[file]) |
(response,
list)
where list is a list of help strings.
If the file parameter is supplied, then the output of the
"HELP" command is stored in a file. If file is a string,
then the method will open a file object with that name, write to it
then close it. If file is a file object, then it will start
calling write() on it to store the lines of the command output.
If file is supplied, then the returned list is an empty list.
id) |
(response, number, id)
where
number is the article number (as a string) and id is the
article id (enclosed in "<" and ">").
) |
) |
id) |
(response, number, id, list)
where the first three are the same as for stat(),
and list is a list of the article's headers (an uninterpreted
list of lines, without trailing newlines).
id,[file]) |
id) |
) |
header, string, [file]) |
'subject'
. The string argument should have
the form 'first-last'
where first and
last are the first and last article numbers to search. Return a
pair (response, list)
, where list is a list of
pairs (id, text)
, where id is an article id
(as a string) and text is the text of the requested header for
that article.
If the file parameter is supplied, then the output of the
"XHDR" command is stored in a file. If file is a string,
then the method will open a file object with that name, write to it
then close it. If file is a file object, then it will start
calling write() on it to store the lines of the command output.
If file is supplied, then the returned list is an empty list.
file) |
id, file) |
) |
(response, date, time)
,
containing the current date and time in a form suitable for the
newnews() and newgroups() methods.
This is an optional NNTP extension, and may not be supported by all
servers.
name, [file]) |
(response,
list)
, where list is a list of tuples containing
(name, title)
.
If the file parameter is supplied, then the output of the
"XGTITLE" command is stored in a file. If file is a string,
then the method will open a file object with that name, write to it
then close it. If file is a file object, then it will start
calling write() on it to store the lines of the command output.
If file is supplied, then the returned list is an empty list.
This is an optional NNTP extension, and may not be supported by all
servers.
RFC2980 says ``It is suggested that this extension be deprecated''. Use descriptions() or description() instead.
start, end, [file]) |
(resp, list)
. list is a list
of tuples, one for each article in the range delimited by the start
and end article numbers. Each tuple is of the form
(article number, subject, poster, date,
id, references, size, lines)
.
If the file parameter is supplied, then the output of the
"XOVER" command is stored in a file. If file is a string,
then the method will open a file object with that name, write to it
then close it. If file is a file object, then it will start
calling write() on it to store the lines of the command output.
If file is supplied, then the returned list is an empty list.
This is an optional NNTP extension, and may not be supported by all
servers.
id) |
(resp, path)
, where path is the
directory path to the article with message ID id. This is an
optional NNTP extension, and may not be supported by all servers.
) |