1998-08-10 16:42:37 -03:00
|
|
|
\section{\module{nntplib} ---
|
1999-04-22 13:45:26 -03:00
|
|
|
NNTP protocol client}
|
1998-07-23 14:59:49 -03:00
|
|
|
|
1999-04-22 13:45:26 -03:00
|
|
|
\declaremodule{standard}{nntplib}
|
1998-07-23 14:59:49 -03:00
|
|
|
\modulesynopsis{NNTP protocol client (requires sockets).}
|
|
|
|
|
1998-01-07 09:23:32 -04:00
|
|
|
\indexii{NNTP}{protocol}
|
1998-07-02 16:33:43 -03:00
|
|
|
\index{Network News Transfer Protocol}
|
1995-02-28 13:14:32 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
This module defines the class \class{NNTP} which implements the client
|
1995-03-22 11:48:46 -04:00
|
|
|
side of the NNTP protocol. It can be used to implement a news reader
|
|
|
|
or poster, or automated news processors. For more information on NNTP
|
1998-02-09 15:16:20 -04:00
|
|
|
(Network News Transfer Protocol), see Internet \rfc{977}.
|
1995-03-22 11:48:46 -04:00
|
|
|
|
1995-03-24 11:56:02 -04:00
|
|
|
Here are two small examples of how it can be used. To list some
|
|
|
|
statistics about a newsgroup and print the subjects of the last 10
|
|
|
|
articles:
|
1995-03-22 11:48:46 -04:00
|
|
|
|
1998-02-13 02:58:54 -04:00
|
|
|
\begin{verbatim}
|
1995-03-22 11:48:46 -04:00
|
|
|
>>> s = NNTP('news.cwi.nl')
|
|
|
|
>>> 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 59 articles, range 3742 to 3803
|
|
|
|
>>> resp, subs = s.xhdr('subject', first + '-' + last)
|
|
|
|
>>> for id, sub in subs[-10:]: print id, sub
|
|
|
|
...
|
|
|
|
3792 Re: Removing elements from a list while iterating...
|
|
|
|
3793 Re: Who likes Info files?
|
|
|
|
3794 Emacs and doc strings
|
|
|
|
3795 a few questions about the Mac implementation
|
|
|
|
3796 Re: executable python scripts
|
|
|
|
3797 Re: executable python scripts
|
|
|
|
3798 Re: a few questions about the Mac implementation
|
|
|
|
3799 Re: PROPOSAL: A Generic Python Object Interface for Python C Modules
|
|
|
|
3802 Re: executable python scripts
|
1998-02-09 16:27:12 -04:00
|
|
|
3803 Re: \POSIX{} wait and SIGCHLD
|
1995-03-22 11:48:46 -04:00
|
|
|
>>> s.quit()
|
|
|
|
'205 news.cwi.nl closing connection. Goodbye.'
|
1998-02-13 02:58:54 -04:00
|
|
|
\end{verbatim}
|
1995-03-22 11:48:46 -04:00
|
|
|
|
|
|
|
To post an article from a file (this assumes that the article has
|
|
|
|
valid headers):
|
|
|
|
|
1998-02-13 02:58:54 -04:00
|
|
|
\begin{verbatim}
|
1995-03-22 11:48:46 -04:00
|
|
|
>>> s = NNTP('news.cwi.nl')
|
|
|
|
>>> f = open('/tmp/article')
|
|
|
|
>>> s.post(f)
|
|
|
|
'240 Article posted successfully.'
|
|
|
|
>>> s.quit()
|
|
|
|
'205 news.cwi.nl closing connection. Goodbye.'
|
1998-02-13 02:58:54 -04:00
|
|
|
\end{verbatim}
|
1999-04-22 13:45:26 -03:00
|
|
|
|
1995-03-24 11:56:02 -04:00
|
|
|
The module itself defines the following items:
|
|
|
|
|
1998-11-16 13:11:30 -04:00
|
|
|
\begin{classdesc}{NNTP}{host\optional{, port
|
2000-02-10 16:26:45 -04:00
|
|
|
\optional{, user\optional{, password
|
2004-08-03 11:36:32 -03:00
|
|
|
\optional{, readermode}
|
|
|
|
\optional{, usenetrc}}}}}
|
1998-04-04 03:15:02 -04:00
|
|
|
Return a new instance of the \class{NNTP} class, representing a
|
1995-03-24 11:56:02 -04:00
|
|
|
connection to the NNTP server running on host \var{host}, listening at
|
1998-11-16 13:11:30 -04:00
|
|
|
port \var{port}. The default \var{port} is 119. If the optional
|
2002-12-31 11:28:44 -04:00
|
|
|
\var{user} and \var{password} are provided,
|
2004-08-03 11:36:32 -03:00
|
|
|
or if suitable credentials are present in \file{~/.netrc} and the
|
|
|
|
optional flag \var{usenetrc} is true (the default),
|
2002-12-31 11:28:44 -04:00
|
|
|
the \samp{AUTHINFO USER} and \samp{AUTHINFO PASS} commands are used to
|
2000-02-10 16:26:45 -04:00
|
|
|
identify and authenticate the user to the server. If the optional
|
|
|
|
flag \var{readermode} is true, then a \samp{mode reader} command is
|
|
|
|
sent before authentication is performed. Reader mode is sometimes
|
|
|
|
necessary if you are connecting to an NNTP server on the local machine
|
|
|
|
and intend to call reader-specific commands, such as \samp{group}. If
|
2006-04-21 07:40:58 -03:00
|
|
|
you get unexpected \exception{NNTPPermanentError}s, you might need to set
|
2000-02-10 16:26:45 -04:00
|
|
|
\var{readermode}. \var{readermode} defaults to \code{None}.
|
2004-08-03 11:36:32 -03:00
|
|
|
\var{usenetrc} defaults to \code{True}.
|
|
|
|
|
|
|
|
\versionchanged[\var{usenetrc} argument added]{2.4}
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{classdesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
2006-04-21 07:40:58 -03:00
|
|
|
\begin{excdesc}{NNTPError}
|
|
|
|
Derived from the standard exception \exception{Exception}, this is the
|
|
|
|
base class for all exceptions raised by the \module{nntplib} module.
|
|
|
|
\end{excdesc}
|
2000-02-10 16:26:45 -04:00
|
|
|
|
2006-04-21 07:40:58 -03:00
|
|
|
\begin{excdesc}{NNTPReplyError}
|
2000-02-10 16:26:45 -04:00
|
|
|
Exception raised when an unexpected reply is received from the
|
|
|
|
server. For backwards compatibility, the exception \code{error_reply}
|
|
|
|
is equivalent to this class.
|
2006-04-21 07:40:58 -03:00
|
|
|
\end{excdesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
2006-04-21 07:40:58 -03:00
|
|
|
\begin{excdesc}{NNTPTemporaryError}
|
2000-02-10 16:26:45 -04:00
|
|
|
Exception raised when an error code in the range 400--499 is
|
|
|
|
received. For backwards compatibility, the exception
|
|
|
|
\code{error_temp} is equivalent to this class.
|
2006-04-21 07:40:58 -03:00
|
|
|
\end{excdesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
2006-04-21 07:40:58 -03:00
|
|
|
\begin{excdesc}{NNTPPermanentError}
|
2000-02-10 16:26:45 -04:00
|
|
|
Exception raised when an error code in the range 500--599 is
|
|
|
|
received. For backwards compatibility, the exception
|
|
|
|
\code{error_perm} is equivalent to this class.
|
2006-04-21 07:40:58 -03:00
|
|
|
\end{excdesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
2006-04-21 07:40:58 -03:00
|
|
|
\begin{excdesc}{NNTPProtocolError}
|
1995-03-24 11:56:02 -04:00
|
|
|
Exception raised when a reply is received from the server that does
|
2000-02-10 16:26:45 -04:00
|
|
|
not begin with a digit in the range 1--5. For backwards
|
|
|
|
compatibility, the exception \code{error_proto} is equivalent to this
|
|
|
|
class.
|
2006-04-21 07:40:58 -03:00
|
|
|
\end{excdesc}
|
2000-02-10 16:26:45 -04:00
|
|
|
|
2006-04-21 07:40:58 -03:00
|
|
|
\begin{excdesc}{NNTPDataError}
|
2000-02-10 16:26:45 -04:00
|
|
|
Exception raised when there is some error in the response data. For
|
|
|
|
backwards compatibility, the exception \code{error_data} is
|
|
|
|
equivalent to this class.
|
2006-04-21 07:40:58 -03:00
|
|
|
\end{excdesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
|
1999-04-22 13:45:26 -03:00
|
|
|
\subsection{NNTP Objects \label{nntp-objects}}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
|
|
|
NNTP instances have the following methods. The \var{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.
|
|
|
|
|
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{getwelcome}{}
|
1995-03-24 11:56:02 -04:00
|
|
|
Return the welcome message sent by the server in reply to the initial
|
|
|
|
connection. (This message sometimes contains disclaimers or help
|
|
|
|
information that may be relevant to the user.)
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{set_debuglevel}{level}
|
1995-03-24 11:56:02 -04:00
|
|
|
Set the instance's debugging level. This controls the amount of
|
1998-04-04 03:15:02 -04:00
|
|
|
debugging output printed. The default, \code{0}, produces no debugging
|
|
|
|
output. A value of \code{1} produces a moderate amount of debugging
|
|
|
|
output, generally a single line per request or response. A value of
|
|
|
|
\code{2} or higher produces the maximum amount of debugging output,
|
|
|
|
logging each line sent and received on the connection (including
|
|
|
|
message text).
|
|
|
|
\end{methoddesc}
|
|
|
|
|
2003-04-19 15:04:57 -03:00
|
|
|
\begin{methoddesc}{newgroups}{date, time, \optional{file}}
|
1995-03-24 11:56:02 -04:00
|
|
|
Send a \samp{NEWGROUPS} command. The \var{date} argument should be a
|
1999-04-22 13:45:26 -03:00
|
|
|
string of the form \code{'\var{yy}\var{mm}\var{dd}'} indicating the
|
1995-03-24 11:56:02 -04:00
|
|
|
date, and \var{time} should be a string of the form
|
1999-04-22 13:45:26 -03:00
|
|
|
\code{'\var{hh}\var{mm}\var{ss}'} indicating the time. Return a pair
|
1995-03-24 11:56:02 -04:00
|
|
|
\code{(\var{response}, \var{groups})} where \var{groups} is a list of
|
|
|
|
group names that are new since the given date and time.
|
2003-04-19 15:04:57 -03:00
|
|
|
If the \var{file} parameter is supplied, then the output of the
|
|
|
|
\samp{NEWGROUPS} command is stored in a file. If \var{file} is a string,
|
|
|
|
then the method will open a file object with that name, write to it
|
|
|
|
then close it. If \var{file} is a file object, then it will start
|
|
|
|
calling \method{write()} on it to store the lines of the command output.
|
|
|
|
If \var{file} is supplied, then the returned \var{list} is an empty list.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
2003-04-19 15:04:57 -03:00
|
|
|
\begin{methoddesc}{newnews}{group, date, time, \optional{file}}
|
1995-03-24 11:56:02 -04:00
|
|
|
Send a \samp{NEWNEWS} command. Here, \var{group} is a group name or
|
1998-04-04 03:15:02 -04:00
|
|
|
\code{'*'}, and \var{date} and \var{time} have the same meaning as for
|
|
|
|
\method{newgroups()}. Return a pair \code{(\var{response},
|
2005-07-17 17:27:41 -03:00
|
|
|
\var{articles})} where \var{articles} is a list of message ids.
|
2003-04-19 15:04:57 -03:00
|
|
|
If the \var{file} parameter is supplied, then the output of the
|
|
|
|
\samp{NEWNEWS} command is stored in a file. If \var{file} is a string,
|
|
|
|
then the method will open a file object with that name, write to it
|
|
|
|
then close it. If \var{file} is a file object, then it will start
|
|
|
|
calling \method{write()} on it to store the lines of the command output.
|
|
|
|
If \var{file} is supplied, then the returned \var{list} is an empty list.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
2003-04-19 15:04:57 -03:00
|
|
|
\begin{methoddesc}{list}{\optional{file}}
|
1995-03-24 11:56:02 -04:00
|
|
|
Send a \samp{LIST} command. Return a pair \code{(\var{response},
|
|
|
|
\var{list})} where \var{list} is a list of tuples. Each tuple has the
|
|
|
|
form \code{(\var{group}, \var{last}, \var{first}, \var{flag})}, where
|
|
|
|
\var{group} is a group name, \var{last} and \var{first} are the last
|
1999-04-22 13:45:26 -03:00
|
|
|
and first article numbers (as strings), and \var{flag} is
|
|
|
|
\code{'y'} if posting is allowed, \code{'n'} if not, and \code{'m'} if
|
|
|
|
the newsgroup is moderated. (Note the ordering: \var{last},
|
|
|
|
\var{first}.)
|
2003-04-19 15:04:57 -03:00
|
|
|
If the \var{file} parameter is supplied, then the output of the
|
|
|
|
\samp{LIST} command is stored in a file. If \var{file} is a string,
|
|
|
|
then the method will open a file object with that name, write to it
|
|
|
|
then close it. If \var{file} is a file object, then it will start
|
|
|
|
calling \method{write()} on it to store the lines of the command output.
|
|
|
|
If \var{file} is supplied, then the returned \var{list} is an empty list.
|
2004-07-30 13:08:49 -03:00
|
|
|
\end{methoddesc}
|
2004-07-26 09:40:50 -03:00
|
|
|
|
|
|
|
\begin{methoddesc}{descriptions}{grouppattern}
|
|
|
|
Send a \samp{LIST NEWSGROUPS} command, where \var{grouppattern} is a wildmat
|
|
|
|
string as specified in RFC2980 (it's essentially the same as DOS or UNIX
|
|
|
|
shell wildcard strings). Return a pair \code{(\var{response},
|
|
|
|
\var{list})}, where \var{list} is a list of tuples containing
|
|
|
|
\code{(\var{name}, \var{title})}.
|
2004-07-30 13:08:49 -03:00
|
|
|
|
|
|
|
\versionadded{2.4}
|
2004-07-26 09:40:50 -03:00
|
|
|
\end{methoddesc}
|
|
|
|
|
|
|
|
\begin{methoddesc}{description}{group}
|
|
|
|
Get a description for a single group \var{group}. If more than one group
|
2004-07-30 13:08:49 -03:00
|
|
|
matches (if 'group' is a real wildmat string), return the first match.
|
|
|
|
If no group matches, return an empty string.
|
2004-07-26 09:40:50 -03:00
|
|
|
|
|
|
|
This elides the response code from the server. If the response code is
|
|
|
|
needed, use \method{descriptions()}.
|
|
|
|
|
2004-07-30 13:08:49 -03:00
|
|
|
\versionadded{2.4}
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{group}{name}
|
1995-03-24 11:56:02 -04:00
|
|
|
Send a \samp{GROUP} command, where \var{name} is the group name.
|
1999-04-22 13:45:26 -03:00
|
|
|
Return a tuple \code{(\var{response}, \var{count}, \var{first},
|
|
|
|
\var{last}, \var{name})} where \var{count} is the (estimated) number
|
|
|
|
of articles in the group, \var{first} is the first article number in
|
|
|
|
the group, \var{last} is the last article number in the group, and
|
|
|
|
\var{name} is the group name. The numbers are returned as strings.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
|
|
|
|
2003-04-19 15:04:57 -03:00
|
|
|
\begin{methoddesc}{help}{\optional{file}}
|
1995-03-24 11:56:02 -04:00
|
|
|
Send a \samp{HELP} command. Return a pair \code{(\var{response},
|
|
|
|
\var{list})} where \var{list} is a list of help strings.
|
2003-04-19 15:04:57 -03:00
|
|
|
If the \var{file} parameter is supplied, then the output of the
|
|
|
|
\samp{HELP} command is stored in a file. If \var{file} is a string,
|
|
|
|
then the method will open a file object with that name, write to it
|
|
|
|
then close it. If \var{file} is a file object, then it will start
|
|
|
|
calling \method{write()} on it to store the lines of the command output.
|
|
|
|
If \var{file} is supplied, then the returned \var{list} is an empty list.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{stat}{id}
|
1995-03-24 11:56:02 -04:00
|
|
|
Send a \samp{STAT} command, where \var{id} is the message id (enclosed
|
1998-04-04 03:15:02 -04:00
|
|
|
in \character{<} and \character{>}) or an article number (as a string).
|
1996-12-13 18:04:31 -04:00
|
|
|
Return a triple \code{(\var{response}, \var{number}, \var{id})} where
|
1995-03-24 11:56:02 -04:00
|
|
|
\var{number} is the article number (as a string) and \var{id} is the
|
2005-07-17 17:27:41 -03:00
|
|
|
message id (enclosed in \character{<} and \character{>}).
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{next}{}
|
|
|
|
Send a \samp{NEXT} command. Return as for \method{stat()}.
|
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{last}{}
|
|
|
|
Send a \samp{LAST} command. Return as for \method{stat()}.
|
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{head}{id}
|
1995-03-24 11:56:02 -04:00
|
|
|
Send a \samp{HEAD} command, where \var{id} has the same meaning as for
|
1998-06-30 11:53:41 -03:00
|
|
|
\method{stat()}. Return a tuple
|
|
|
|
\code{(\var{response}, \var{number}, \var{id}, \var{list})}
|
|
|
|
where the first three are the same as for \method{stat()},
|
|
|
|
and \var{list} is a list of the article's headers (an uninterpreted
|
1995-03-24 11:56:02 -04:00
|
|
|
list of lines, without trailing newlines).
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
2001-10-18 17:58:25 -03:00
|
|
|
\begin{methoddesc}{body}{id,\optional{file}}
|
1995-03-24 11:56:02 -04:00
|
|
|
Send a \samp{BODY} command, where \var{id} has the same meaning as for
|
2001-10-18 17:58:25 -03:00
|
|
|
\method{stat()}. If the \var{file} parameter is supplied, then
|
|
|
|
the body is stored in a file. If \var{file} is a string, then
|
2001-10-01 10:50:15 -03:00
|
|
|
the method will open a file object with that name, write to it then close it.
|
2001-10-18 17:58:25 -03:00
|
|
|
If \var{file} is a file object, then it will start calling
|
2001-10-01 10:50:15 -03:00
|
|
|
\method{write()} on it to store the lines of the body.
|
2003-04-19 15:04:57 -03:00
|
|
|
Return as for \method{head()}. If \var{file} is supplied, then
|
2001-10-01 10:50:15 -03:00
|
|
|
the returned \var{list} is an empty list.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{article}{id}
|
2000-07-01 14:43:19 -03:00
|
|
|
Send an \samp{ARTICLE} command, where \var{id} has the same meaning as
|
1998-06-30 11:53:41 -03:00
|
|
|
for \method{stat()}. Return as for \method{head()}.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{slave}{}
|
1995-03-24 11:56:02 -04:00
|
|
|
Send a \samp{SLAVE} command. Return the server's \var{response}.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
2003-04-19 15:04:57 -03:00
|
|
|
\begin{methoddesc}{xhdr}{header, string, \optional{file}}
|
1995-03-24 11:56:02 -04:00
|
|
|
Send an \samp{XHDR} command. This command is not defined in the RFC
|
|
|
|
but is a common extension. The \var{header} argument is a header
|
1998-04-04 03:15:02 -04:00
|
|
|
keyword, e.g. \code{'subject'}. The \var{string} argument should have
|
1999-04-22 13:45:26 -03:00
|
|
|
the form \code{'\var{first}-\var{last}'} where \var{first} and
|
1995-03-24 11:56:02 -04:00
|
|
|
\var{last} are the first and last article numbers to search. Return a
|
|
|
|
pair \code{(\var{response}, \var{list})}, where \var{list} is a list of
|
2005-07-17 17:27:41 -03:00
|
|
|
pairs \code{(\var{id}, \var{text})}, where \var{id} is an article number
|
1995-03-24 11:56:02 -04:00
|
|
|
(as a string) and \var{text} is the text of the requested header for
|
|
|
|
that article.
|
2003-04-19 15:04:57 -03:00
|
|
|
If the \var{file} parameter is supplied, then the output of the
|
|
|
|
\samp{XHDR} command is stored in a file. If \var{file} is a string,
|
|
|
|
then the method will open a file object with that name, write to it
|
|
|
|
then close it. If \var{file} is a file object, then it will start
|
|
|
|
calling \method{write()} on it to store the lines of the command output.
|
|
|
|
If \var{file} is supplied, then the returned \var{list} is an empty list.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{post}{file}
|
1995-03-24 11:56:02 -04:00
|
|
|
Post an article using the \samp{POST} command. The \var{file}
|
|
|
|
argument is an open file object which is read until EOF using its
|
1998-04-04 03:15:02 -04:00
|
|
|
\method{readline()} method. It should be a well-formed news article,
|
|
|
|
including the required headers. The \method{post()} method
|
1995-03-24 11:56:02 -04:00
|
|
|
automatically escapes lines beginning with \samp{.}.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{ihave}{id, file}
|
2005-07-17 17:27:41 -03:00
|
|
|
Send an \samp{IHAVE} command. \var{id} is a message id (enclosed in
|
|
|
|
\character{<} and \character{>}).
|
|
|
|
If the response is not an error, treat
|
1998-04-04 03:15:02 -04:00
|
|
|
\var{file} exactly as for the \method{post()} method.
|
|
|
|
\end{methoddesc}
|
1995-03-24 11:56:02 -04:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{date}{}
|
1997-06-02 14:27:50 -03:00
|
|
|
Return a triple \code{(\var{response}, \var{date}, \var{time})},
|
|
|
|
containing the current date and time in a form suitable for the
|
1998-04-04 03:15:02 -04:00
|
|
|
\method{newnews()} and \method{newgroups()} methods.
|
1997-06-02 14:27:50 -03:00
|
|
|
This is an optional NNTP extension, and may not be supported by all
|
|
|
|
servers.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1997-06-02 14:27:50 -03:00
|
|
|
|
2003-04-19 15:04:57 -03:00
|
|
|
\begin{methoddesc}{xgtitle}{name, \optional{file}}
|
1998-04-04 03:15:02 -04:00
|
|
|
Process an \samp{XGTITLE} command, returning a pair \code{(\var{response},
|
1998-02-16 17:57:37 -04:00
|
|
|
\var{list})}, where \var{list} is a list of tuples containing
|
1997-06-02 14:27:50 -03:00
|
|
|
\code{(\var{name}, \var{title})}.
|
|
|
|
% XXX huh? Should that be name, description?
|
2003-04-19 15:04:57 -03:00
|
|
|
If the \var{file} parameter is supplied, then the output of the
|
|
|
|
\samp{XGTITLE} command is stored in a file. If \var{file} is a string,
|
|
|
|
then the method will open a file object with that name, write to it
|
|
|
|
then close it. If \var{file} is a file object, then it will start
|
|
|
|
calling \method{write()} on it to store the lines of the command output.
|
|
|
|
If \var{file} is supplied, then the returned \var{list} is an empty list.
|
1997-06-02 14:27:50 -03:00
|
|
|
This is an optional NNTP extension, and may not be supported by all
|
|
|
|
servers.
|
2004-07-26 09:40:50 -03:00
|
|
|
|
|
|
|
RFC2980 says ``It is suggested that this extension be deprecated''. Use
|
|
|
|
\method{descriptions()} or \method{description()} instead.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1997-06-02 14:27:50 -03:00
|
|
|
|
2003-04-19 15:04:57 -03:00
|
|
|
\begin{methoddesc}{xover}{start, end, \optional{file}}
|
1997-06-02 14:27:50 -03:00
|
|
|
Return a pair \code{(\var{resp}, \var{list})}. \var{list} is a list
|
|
|
|
of tuples, one for each article in the range delimited by the \var{start}
|
|
|
|
and \var{end} article numbers. Each tuple is of the form
|
1999-04-22 13:45:26 -03:00
|
|
|
\code{(\var{article number}, \var{subject}, \var{poster}, \var{date},
|
|
|
|
\var{id}, \var{references}, \var{size}, \var{lines})}.
|
2003-04-19 15:04:57 -03:00
|
|
|
If the \var{file} parameter is supplied, then the output of the
|
|
|
|
\samp{XOVER} command is stored in a file. If \var{file} is a string,
|
|
|
|
then the method will open a file object with that name, write to it
|
|
|
|
then close it. If \var{file} is a file object, then it will start
|
|
|
|
calling \method{write()} on it to store the lines of the command output.
|
|
|
|
If \var{file} is supplied, then the returned \var{list} is an empty list.
|
1997-06-02 14:27:50 -03:00
|
|
|
This is an optional NNTP extension, and may not be supported by all
|
|
|
|
servers.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1997-06-02 14:27:50 -03:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{xpath}{id}
|
1997-06-02 14:27:50 -03:00
|
|
|
Return a pair \code{(\var{resp}, \var{path})}, where \var{path} is the
|
|
|
|
directory path to the article with message ID \var{id}. This is an
|
|
|
|
optional NNTP extension, and may not be supported by all servers.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|
1997-06-02 14:27:50 -03:00
|
|
|
|
1998-04-04 03:15:02 -04:00
|
|
|
\begin{methoddesc}{quit}{}
|
1995-03-24 11:56:02 -04:00
|
|
|
Send a \samp{QUIT} command and close the connection. Once this method
|
|
|
|
has been called, no other methods of the NNTP object should be called.
|
1998-04-04 03:15:02 -04:00
|
|
|
\end{methoddesc}
|