GNU Info

Info Node: (python2.1-lib.info)NNTP Objects

(python2.1-lib.info)NNTP Objects


Prev: nntplib Up: nntplib
Enter node , (file) or (file)node

NNTP Objects
------------

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.

`getwelcome()'
     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.)

`set_debuglevel(level)'
     Set the instance's debugging level.  This controls the amount of
     debugging output printed.  The default, `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).

`newgroups(date, time)'
     Send a `NEWGROUPS' command.  The DATE argument should be a string
     of the form `'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.

`newnews(group, date, time)'
     Send a `NEWNEWS' command.  Here, GROUP is a group name or `'*'',
     and DATE and TIME have the same meaning as for `newgroups()'.
     Return a pair `(RESPONSE, ARTICLES)' where ARTICLES is a list of
     article ids.

`list()'
     Send a `LIST' command.  Return a pair `(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.)

`group(name)'
     Send a `GROUP' command, where NAME is the group name.  Return a
     tuple `(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.

`help()'
     Send a `HELP' command.  Return a pair `(RESPONSE, LIST)' where
     LIST is a list of help strings.

`stat(id)'
     Send a `STAT' command, where ID is the message id (enclosed in `<'
     and `>') or an article number (as a string).  Return a triple
     `(RESPONSE, NUMBER, ID)' where NUMBER is the article number (as a
     string) and ID is the article id  (enclosed in `<' and `>').

`next()'
     Send a `NEXT' command.  Return as for `stat()'.

`last()'
     Send a `LAST' command.  Return as for `stat()'.

`head(id)'
     Send a `HEAD' command, where ID has the same meaning as for
     `stat()'.  Return a tuple `(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).

`body(id)'
     Send a `BODY' command, where ID has the same meaning as for
     `stat()'.  Return as for `head()'.

`article(id)'
     Send an `ARTICLE' command, where ID has the same meaning as for
     `stat()'.  Return as for `head()'.

`slave()'
     Send a `SLAVE' command.  Return the server's RESPONSE.

`xhdr(header, string)'
     Send an `XHDR' command.  This command is not defined in the RFC
     but is a common extension.  The HEADER argument is a header
     keyword, e.g. `'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.

`post(file)'
     Post an article using the `POST' command.  The FILE argument is an
     open file object which is read until EOF using its `readline()'
     method.  It should be a well-formed news article, including the
     required headers.  The `post()' method automatically escapes lines
     beginning with `.'.

`ihave(id, file)'
     Send an `IHAVE' command.  If the response is not an error, treat
     FILE exactly as for the `post()' method.

`date()'
     Return a triple `(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.

`xgtitle(name)'
     Process an `XGTITLE' command, returning a pair `(RESPONSE, LIST)',
     where LIST is a list of tuples containing `(NAME, TITLE)'.  This
     is an optional NNTP extension, and may not be supported by all
     servers.

`xover(start, end)'
     Return a pair `(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)'.  This is an optional
     NNTP extension, and may not be supported by all servers.

`xpath(id)'
     Return a pair `(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.

`quit()'
     Send a `QUIT' command and close the connection.  Once this method
     has been called, no other methods of the NNTP object should be
     called.


automatically generated by info2www version 1.2.2.9