| |
- Node
- NodeBuilder
-
- Stream
-
- Client
- Server
- error
class Client(Stream) |
| |
- Method resolution order:
- Client
- Stream
- NodeBuilder
Methods defined here:
- __init__(self, host, port, namespace, debug=['always'], log=None, sock=None, id=None, connection=1, hostIP=None, proxy=None)
- connect(self)
- Attempt to connect to specified host
- getSocket(self)
Methods inherited from Stream:
- disconnect(self)
- Close the stream and socket
- disconnectHandler(self, conn)
- Called when a Network Error or disconnection occurs.
Designed to be overidden
- disconnected(self, conn)
- Called when a Network Error or disconnection occurs.
- getIncomingID(self)
- Returns the streams ID
- getOutgoingID(self)
- Returns the streams ID
- log(self, data, inout='')
- Logs data to the specified filehandle. Data is time stamped
and prefixed with inout
- process(self, timeout=0)
- Receives incoming data (if any) and processes it.
Waits for data no more than timeout seconds.
- read(self)
- Reads incoming data. Blocks until done. Calls disconnected(self) if appropriate.
- timestampLog(self, timestamp)
- Enable or disable the showing of a timestamp in the log.
By default, timestamping is enabled.
- write(self, raw_data)
- Writes raw outgoing data. Blocks until done.
If supplied data is not unicode string, ENCODING
is used for convertion. Avoid this!
Always send your data as a unicode string.
Methods inherited from NodeBuilder:
- DEBUG(self, dup1, dup2=None)
- dispatch(self, dom)
- getDom(self)
- handle_data(self, data)
- XML Parser callback
- unknown_endtag(self, tag)
- XML Parser callback
- unknown_starttag(self, tag, attrs)
- XML Parser callback
|
class Node |
|
A simple XML DOM like class |
|
Methods defined here:
- __init__(self, tag=None, parent=None, attrs={}, payload=[], node=None)
- __str__(self)
- getAttr(self, key)
- Get a value for the nodes named attribute.
- getChildren(self)
- Returns a nodes children
- getData(self)
- Return the nodes textual data
- getDataAsParts(self)
- Return the node data as an array
- getName(self)
- Set the nodes tag name.
- getNamespace(self)
- Returns the nodes namespace.
- getParent(self)
- return the nodes parent node.
- getTag(self, name, index=None)
- Returns a child node with tag name. Returns None
if not found.
- getTags(self, name)
- Like getTag but returns a list with matching child nodes
- insertData(self, data)
- Set the nodes textual data
- insertNode(self, node)
- Add a child node to the node
- insertTag(self, name=None, attrs={}, payload=[], node=None)
- Add a child tag of name 'name' to the node.
Returns the newly created node.
- insertXML(self, xml_str)
- Add raw xml as a child of the node
- putAttr(self, key, val)
- Add a name/value attribute to the node.
- putData(self, data)
- Set the nodes textual data
- removeTag(self, tag)
- Pops out specified child and returns it.
- setName(self, val)
- Set the nodes tag name.
- setNamespace(self, namespace)
- Set the nodes namespace.
- setParent(self, node)
- Set the nodes parent node.
|
class Stream(NodeBuilder) |
|
Extention of NodeBuilder class. Handles stream of XML stanzas.
Calls dispatch method for every child of root node
(stream:stream for jabber stream).
attributes _read, _write and _reader must be set by external entity |
|
Methods defined here:
- __init__(self, namespace, debug=['always'], log=None, id=None, timestampLog=1)
- connect(self)
- disconnect(self)
- Close the stream and socket
- disconnectHandler(self, conn)
- Called when a Network Error or disconnection occurs.
Designed to be overidden
- disconnected(self, conn)
- Called when a Network Error or disconnection occurs.
- getIncomingID(self)
- Returns the streams ID
- getOutgoingID(self)
- Returns the streams ID
- log(self, data, inout='')
- Logs data to the specified filehandle. Data is time stamped
and prefixed with inout
- process(self, timeout=0)
- Receives incoming data (if any) and processes it.
Waits for data no more than timeout seconds.
- read(self)
- Reads incoming data. Blocks until done. Calls disconnected(self) if appropriate.
- timestampLog(self, timestamp)
- Enable or disable the showing of a timestamp in the log.
By default, timestamping is enabled.
- write(self, raw_data)
- Writes raw outgoing data. Blocks until done.
If supplied data is not unicode string, ENCODING
is used for convertion. Avoid this!
Always send your data as a unicode string.
Methods inherited from NodeBuilder:
- DEBUG(self, dup1, dup2=None)
- dispatch(self, dom)
- getDom(self)
- handle_data(self, data)
- XML Parser callback
- unknown_endtag(self, tag)
- XML Parser callback
- unknown_starttag(self, tag, attrs)
- XML Parser callback
|
|