Package twisted :: Package protocols :: Module nntp :: Class NNTPClient

[frames | no frames]

## Class NNTPClient

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

Known Subclasses:
  `UsenetClientProtocol`

Method Summary
| `__init__(self)`
| `_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)`
| ``connectionMade`(self)` Called when a connection is made.
| ``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
| ``getNewNewsFailed`(self, error)` Override for notification when getNewNews() 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
| ``gotArticle`(self, article)` Override for notification when fetchArticle() 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
| ``gotNewNews`(self, news)` Override for notification when getNewNews() 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
`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

### 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.internet.protocol.BaseProtocol.connectionMade` (inherited documentation)

### 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. gotArticle() is called on success, getArticleFailed() on failure.

### fetchBody(self, index='')

Get the body for the specified article (or the currently selected article if index is '') from the server. gotBody() is called on success, getBodyFailed() on failure

### fetchGroup(self, group)

Get group information for the specified group from the server. gotGroup() is called on success, getGroupFailed() on failure.

### fetchGroups(self)

Request a list of all news groups from the server. gotAllGroups() is called on success, getGroupsFailed() on failure

### fetchHead(self, index='')

Get the header for the specified article (or the currently selected article if index is '') from the server. gotHead() is called on success, getHeadFailed() on failure

### 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. gotNewGroups() is called on success, getNewGroupsFailed() on failure.

### 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. gotNewNews() is called on success, getNewNewsFailed() on failure.

One invocation of this function may result in multiple invocations of gotNewNews()/getNewNewsFailed().

### fetchOverview(self)

Request the overview format from the server. gotOverview() is called on success, getOverviewFailed() on failure

### fetchSubscriptions(self)

Request a list of the groups it is recommended a new user subscribe to. gotSubscriptions() is called on success, getSubscriptionsFailed() on failure

### fetchXHeader(self, header, low=None, high=None, id=None)

Request a specific header from the server for an article or range of articles. If 'id' is not None, a header for only the article with that Message-ID will be requested. If both low and high are None, a header for the currently selected article will be selected; If both low and high are zero-length strings, headers for all articles in the currently selected group will be requested; Otherwise, high and low will be used as bounds - if one is None the first or last article index will be substituted, as appropriate.

### 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

### getNewNewsFailed(self, error)

Override for notification when getNewNews() 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

### gotArticle(self, article)

Override for notification when fetchArticle() 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

### gotNewNews(self, news)

Override for notification when getNewNews() 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.

  Overrides:
    `twisted.protocols.basic.LineReceiver.lineReceived` (inherited documentation)

### postArticle(self, text)

Attempt to post an article with the specified text to the server. 'text' must consist of both head and body data, as specified by RFC 850. If the article is posted successfully, postedOk() is called, otherwise postFailed() is called.

### postedOk(self)

Override for notification when postArticle() action is successful

### postFailed(self, error)

Override for notification when postArticle() action fails

### setStream(self)

Set the mode to STREAM, suspending the normal "lock-step" mode of communications. setStreamSuccess() is called on success, setStreamFailed() on failure.

### setStreamFailed(self, error)

Override for notification when setStream() action fails

### setStreamSuccess(self)

Override for notification when setStream() action is successful

Class Variable Details

### MAX_COMMAND_LENGTH

  Type:
    `int`
  Value:

        510

Generated by Epydoc 2.0 on Sat May 15 20:08:24 2004 | http://epydoc.sf.net