Package library :: Package pyjamas :: Module JSONService :: Class JSONService
[hide private]
[frames] | no frames]

Class JSONService

source code

object --+
         |
        JSONService

Instance Methods [hide private]
 
__init__(self, url, handler=None, headers=None)
Create a JSON remote service object.
source code
 
callMethod(self, method, params, handler=None) source code
 
onCompletion(self, response) source code
 
sendNotify(self, method, params) source code
 
sendRequest(self, method, params, handler) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  content_type = 'application/json-rpc'
  accept = 'application/json-rpc'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, url, handler=None, headers=None)
(Constructor)

source code 

Create a JSON remote service object. The url is the URL that will receive POST data with the JSON request. See the JSON-RPC spec for more information.

The handler object should implement:

   onRemoteResponse(value, requestInfo)

to accept the return value of the remote method, and:

   onRemoteError(code, error_dict, requestInfo)
        code = http-code or 0
        error_dict is an jsonrpc 2.0 error dict:
            {
              'code': jsonrpc-error-code (integer) ,
              'message': jsonrpc-error-message (string) ,
              'data' : extra-error-data
            }

to handle errors.

Overrides: object.__init__