client.ShetClient Class Reference
A SHET client.
More...
List of all members.
Public Member Functions |
|
def | __init__ |
| def | add_property |
| | Create a property.
|
| def | remove_property |
| | Remove a property.
|
| def | add_event |
| | Create an event.
|
| def | remove_event |
| | Remove an event.
|
| def | watch_event |
| | Watch an event on the server.
|
| def | unwatch_event |
| | Stop watching an event.
|
| def | add_action |
| | Create an action.
|
| def | remove_action |
| | Remove an action.
|
| def | call |
| | Call an action on the server.
|
| def | get |
| | Get a property on the server.
|
| def | set |
| | Set a property on the server.
|
| def | install |
| | Install this instance into the twisted reactor.
|
| def | run |
| | Run this instance of the client.
|
| def | stop |
| | Stop the client.
|
Public Attributes |
|
| properties |
|
| events |
|
| watched_events |
|
| actions |
|
| get_queue |
|
| set_queue |
|
| raise_queue |
|
| call_queue |
|
| client |
Static Public Attributes |
|
| protocol = ShetClientProtocol |
Detailed Description
A SHET client.
Subclass this to add functionality, or possibly use it as-is.
Member Function Documentation
| def client.ShetClient.add_action |
( |
|
self, |
|
|
|
path, |
|
|
|
callback | |
|
) |
| | |
Create an action.
- Parameters:
-
| path | Path to the action. |
| callback | Called when the action is called. |
- Returns:
- An object that can be passed to remove_action() to remove this action.
| def client.ShetClient.add_event |
( |
|
self, |
|
|
|
path | |
|
) |
| | |
Create an event.
- Parameters:
-
| path | The path to the event. |
- Returns:
- An Event object. Pass this to remove_event() to remove the event. Call this like a function to raise the event.
| def client.ShetClient.add_property |
( |
|
self, |
|
|
|
path, |
|
|
|
set_callback, |
|
|
|
get_callback | |
|
) |
| | |
Create a property.
- Parameters:
-
| path | The path of the property. |
| set_callback | Function called with a single argument to set the property. May return a Deferred or any value. |
| get_callback | Function called with no args to get the resending |
- Returns:
- Object representing the property. Pass to remove_property() to remove.
| def client.ShetClient.call |
( |
|
self, |
|
|
|
path, |
|
|
|
args | |
|
) |
| | |
Call an action on the server.
- Parameters:
-
| path | Path to the action. |
| *args | the arguments of the action. |
- Returns:
- The Deferred result of the action.
| def client.ShetClient.get |
( |
|
self, |
|
|
|
path | |
|
) |
| | |
Get a property on the server.
- Parameters:
-
| path | The path to the property. |
- Returns:
- The Deferred value of the property.
| def client.ShetClient.install |
( |
|
self, |
|
|
|
address, |
|
|
|
port = 11235 | |
|
) |
| | |
Install this instance into the twisted reactor.
Use this if you want to run some other service in parallel.
- Parameters:
-
| address | address to connect to. |
| port | the port to use. |
| def client.ShetClient.remove_action |
( |
|
self, |
|
|
|
action | |
|
) |
| | |
Remove an action.
- Parameters:
-
| def client.ShetClient.remove_event |
( |
|
self, |
|
|
|
event | |
|
) |
| | |
Remove an event.
- Parameters:
-
| def client.ShetClient.remove_property |
( |
|
self, |
|
|
|
prop | |
|
) |
| | |
Remove a property.
- Parameters:
-
| def client.ShetClient.run |
( |
|
self, |
|
|
|
address, |
|
|
|
port = 11235 | |
|
) |
| | |
Run this instance of the client.
This will not return until stop() is called.
nb: This calls twisted.internet.reactor.run().
- Parameters:
-
| address | address to connect to. |
| port | the port to use. |
| def client.ShetClient.set |
( |
|
self, |
|
|
|
path, |
|
|
|
value | |
|
) |
| | |
Set a property on the server.
- Parameters:
-
| path | The path to the property. |
| value | The new value. |
- Returns:
- Deferred success/failure.
| def client.ShetClient.stop |
( |
|
self |
) |
|
Stop the client.
nb: This calls twisted.internet.reactor.stop()
| def client.ShetClient.unwatch_event |
( |
|
self, |
|
|
|
event | |
|
) |
| | |
Stop watching an event.
- Parameters:
-
| def client.ShetClient.watch_event |
( |
|
self, |
|
|
|
path, |
|
|
|
callback, |
|
|
|
delete_callback = lambda:None | |
|
) |
| | |
Watch an event on the server.
- Parameters:
-
| path | Path to the event. |
| callback | Called when the event is raised. |
| delete_callback | Called if the event is deleted. |
- Returns:
- An object that can be passed to unwatch_event() to stop watching this event.
The documentation for this class was generated from the following file: