RPCServer Module
Bases: twisted.internet.protocol.Protocol
This method is called when the client is disconnected.
| Parameter: | reason (str) – the reason the client disconnected. |
|---|
This method is called whenever data is received from a client. The only message that a client sends to the server is a RPC Request message. If the RPC Request message is valid, then the method is called in dispatch().
| Parameter: | data (str) – the data from the client. It should be a zlib compressed rencoded string. |
|---|
This method is run when a RPC Request is made. It will run the local method and will send either a RPC Response or RPC Error back to the client.
| Parameters: |
|
|---|
Sends the data to the client.
| Parameter: | data (object) – the object that is to be sent to the client. This should be one of the RPC message types. |
|---|
Bases: deluge.component.Component
This class is used to handle rpc requests from the client. Objects are registered with this class and their methods are exported using the export decorator.
| Parameters: |
|
|---|
Emits the event to interested clients.
| Parameter: | event (deluge.event.DelugeEvent) – the event to emit |
|---|
Returns a list of the exported methods.
| Returns: | the exported methods |
|---|---|
| Return type: | list |
Returns a registered method.
| Parameter: | name (str) – the name of the method, usually in the form of ‘object.method’ |
|---|---|
| Returns: | method |
| Raises KeyError: | |
| if name is not registered | |
Returns the session id of the current RPC.
| Returns: | the session id, this will be -1 if no connections have been made |
|---|---|
| Return type: | int |
Checks if the session is still valid, eg, if the client is still connected.
| Parameter: | session_id (int) – the session id |
|---|---|
| Returns: | True if the session is valid |
| Return type: | bool |
Registers an object to export it’s rpc methods. These methods should be exported with the export decorator prior to registering the object.
| Parameters: |
|
|---|
Bases: object
Create an SSL context.
This loads the servers cert/private key SSL files for use with the SSL transport.
Decorator function to register an object’s method as an RPC. The object will need to be registered with an RPCServer to be effective.
| Parameters: |
|
|---|
Format the RPCRequest message for debug printing
| Parameter: | call (a RPCRequest) – the request |
|---|---|
| Returns: | a formatted string for printing |
| Return type: | str |