Package twisted :: Package protocols :: Module nntp :: Class UsenetClientProtocol |
[frames | no frames]

## Class UsenetClientProtocol

    BaseProtocol --+
                   |
            Protocol --+
                       |
            LineReceiver --+
                           |
                  NNTPClient --+
                               |
                              UsenetClientProtocol

A client that connects to an NNTP server and asks for articles new since a certain time.

Method Summary
| ``__init__`(self, groups, date, storage)` Fetch all new articles from the given groups since the given date and dump them into the given storage.
| `articleExists(self, exists, article)`
| ``connectionMade`(self)` Called when a connection is made.
| `getNewNewsFailed(self, reason)`
| ``gotArticle`(self, article)` Override for notification when fetchArticle() action is completed
| ``gotNewNews`(self, news)` Override for notification when getNewNews() action is successful
Inherited from NNTPClient
| ``_endState`(self)`
| ``_getResponseCode`(self)`
| ``_headerGroup`(self, (code, line))`
| ``_headerInitial`(self, (code, message))`
| ``_headerMode`(self, (code, message))`
| ``_headerPost`(self, (code, message))`
| ``_headerPosted`(self, (code, message))`
| ``_newLine`(self, line, check)`
| ``_newState`(self, method, error, responseHandler)`
| ``_passiveError`(self, error)`
| ``_setResponseCode`(self, code)`
| ``_stateArticle`(self, line)`
| ``_stateBody`(self, line)`
| ``_stateHead`(self, line)`
| ``_stateList`(self, line)`
| ``_stateNewGroups`(self, line)`
| ``_stateNewNews`(self, line)`
| ``_stateOverview`(self, line)`
| ``_statePassive`(self, line)`
| ``_stateSubscriptions`(self, line)`
| ``_stateXHDR`(self, line)`
| ``fetchArticle`(self, index)` Get the complete article with the specified index (or the currently selected article if index is '') or Message-ID from the server.
| ``fetchBody`(self, index)` Get the body for the specified article (or the currently selected article if index is '') from the server.
| ``fetchGroup`(self, group)` Get group information for the specified group from the server.
| ``fetchGroups`(self)` Request a list of all news groups from the server.
| ``fetchHead`(self, index)` Get the header for the specified article (or the currently selected article if index is '') from the server.
| ``fetchNewGroups`(self, date, distributions)` Get the names of all new groups created/added to the server since the specified date - in seconds since the ecpoh, GMT - optionally restricted to the given distributions.
| ``fetchNewNews`(self, groups, date, distributions)` Get the Message-IDs for all new news posted to any of the given groups since the specified date - in seconds since the epoch, GMT - optionally restricted to the given distributions.
| ``fetchOverview`(self)` Request the overview format from the server.
| ``fetchSubscriptions`(self)` Request a list of the groups it is recommended a new user subscribe to.
| ``fetchXHeader`(self, header, low, high, id)` Request a specific header from the server for an article or range of articles.
| ``getAllGroupsFailed`(self, error)` Override for notification when fetchGroups() action fails
| ``getArticleFailed`(self, error)` Override for notification when fetchArticle() action fails
| ``getBodyFailed`(self, body)` Override for notification when fetchBody() action fails
| ``getGroupFailed`(self, error)` Override for notification when fetchGroup() action fails
| ``getHeadFailed`(self, error)` Override for notification when fetchHead() action fails
| ``getNewGroupsFailed`(self, error)` Override for notification when getNewGroups() action fails
| ``getOverviewFailed`(self, error)` Override for notification when fetchOverview() action fails
| ``getSubscriptionsFailed`(self, error)` Override for notification when fetchSubscriptions() action fails
| ``getXHeaderFailed`(self, error)` Override for notification when getXHeader() action fails
| ``gotAllGroups`(self, groups)` Override for notification when fetchGroups() action is completed
| ``gotBody`(self, info)` Override for notification when fetchBody() action is completed
| ``gotGroup`(self, group)` Override for notification when fetchGroup() action is completed
| ``gotHead`(self, head)` Override for notification when fetchHead() action is completed
| ``gotNewGroups`(self, groups)` Override for notification when getNewGroups() action is successful
| ``gotOverview`(self, overview)` Override for notification when fetchOverview() action is completed
| ``gotSubscriptions`(self, subscriptions)` Override for notification when fetchSubscriptions() action is completed
| ``gotXHeader`(self, headers)` Override for notification when getXHeader() action is successful
| ``lineReceived`(self, line)` Override this for when each line is received.
| ``postArticle`(self, text)` Attempt to post an article with the specified text to the server.
| ``postedOk`(self)` Override for notification when postArticle() action is successful
| ``postFailed`(self, error)` Override for notification when postArticle() action fails
| ``quit`(self)`
| ``setStream`(self)` Set the mode to STREAM, suspending the normal "lock-step" mode of communications.
| ``setStreamFailed`(self, error)` Override for notification when setStream() action fails
| ``setStreamSuccess`(self)` Override for notification when setStream() action is successful
Inherited from LineReceiver
| ``clearLineBuffer`(self)` Clear buffered data.
| ``dataReceived`(self, data)` Protocol.dataReceived.
| ``lineLengthExceeded`(self, line)` Called when the maximum line length has been reached.
| ``rawDataReceived`(self, data)` Override this for when raw data is received.
| ``sendLine`(self, line)` Sends a line to the other end of the connection.
| ``setLineMode`(self, extra)` Sets the line-mode of this receiver.
| ``setRawMode`(self)` Sets the raw mode of this receiver.
Inherited from Protocol
| ``connectionFailed`(self)` (Deprecated)
| ``connectionLost`(self, reason)` Called when the connection is shut down.
Inherited from BaseProtocol
| ``makeConnection`(self, transport)` Make a connection to a transport and a server.

Class Variable Summary
Inherited from NNTPClient
`int` | `MAX_COMMAND_LENGTH` = 510
Inherited from LineReceiver
`str` | `_LineReceiver__buffer` = `''`
`str` | `delimiter`: The line-ending delimiter to use.
`int` | `line_mode` = 1
`int` | `MAX_LENGTH`: The maximum length of a line to allow (If a sent line is longer than this, the connection is dropped).
Inherited from Protocol
`tuple` | `__implements__` = `(<class twisted.internet.interfaces.IPr...`
Inherited from BaseProtocol
`int` | `connected` = 0
`NoneType` | `transport` = None

Method Details

### __init__(self, groups, date, storage) (Constructor) Fetch all new articles from the given groups since the given date and dump them into the given storage. groups is a list of group names. date is an integer or floating point representing seconds since the epoch (GMT). storage is any object that implements the NewsStorage interface. Overrides: `twisted.protocols.nntp.NNTPClient.__init__`

### connectionMade(self) Called when a connection is made. This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here. Overrides: `twisted.protocols.nntp.NNTPClient.connectionMade` (inherited documentation)

### gotArticle(self, article) Override for notification when fetchArticle() action is completed Overrides: `twisted.protocols.nntp.NNTPClient.gotArticle` (inherited documentation)

### gotNewNews(self, news) Override for notification when getNewNews() action is successful Overrides: `twisted.protocols.nntp.NNTPClient.gotNewNews` (inherited documentation)

Generated by Epydoc 2.0 on Sat Oct 25 00:54:52 2003 | http://epydoc.sf.net