concurrent.core.transport.pyjsonrpc package

Submodules

concurrent.core.transport.pyjsonrpc.http module

class concurrent.core.transport.pyjsonrpc.http.HttpClient(url, username=None, password=None)[source]

Bases: object

call(method, *args, **kwargs)[source]

Creates the JSON-RPC request string, calls the HTTP server, converts JSON-RPC response string to python and returns the result.

Parameters:method

Name of the method which will be called on the HTTP server. Or a list with RPC-Request-Dictionaries. Syntax:

"<MethodName>" or [<JsonRpcRequestDict>, ...]

RPC-Request-Dictionaries will be made with the function rpcrequest.create_request_dict().

class concurrent.core.transport.pyjsonrpc.http.HttpRequestHandler(request, client_address, server)[source]

Bases: BaseHTTPServer.BaseHTTPRequestHandler, concurrent.core.transport.pyjsonrpc.rpclib.JsonRpc

HttpRequestHandler for JSON-RPC-Requests

Info: http://www.simple-is-better.org/json-rpc/transport_http.html

do_GET()[source]

Handles HTTP-GET-Request

do_POST()[source]

Handles HTTP-POST-Request

protocol_version = 'HTTP/1.1'
set_content_length(length)[source]

Set content-length-header

set_content_type_json()[source]

Set content-type to “application/json”

set_no_cache()[source]

Disable caching

class concurrent.core.transport.pyjsonrpc.http.ThreadingHttpServer(server_address, RequestHandlerClass, bind_and_activate=True)[source]

Bases: SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer

Threading HTTP Server

concurrent.core.transport.pyjsonrpc.http.handle_cgi_request(methods=None)[source]

Gets the JSON-RPC request from CGI environment and returns the result to STDOUT

concurrent.core.transport.pyjsonrpc.http.http_request(url, json_string, username=None, password=None)[source]

Fetch data from webserver (POST request)

Parameters:
  • json_string – JSON-String
  • username – If username is given, BASE authentication will be used.

concurrent.core.transport.pyjsonrpc.rpcerror module

exception concurrent.core.transport.pyjsonrpc.rpcerror.InternalError(message=None, data=None)[source]

Bases: concurrent.core.transport.pyjsonrpc.rpcerror.JsonRpcError

code = -32603
message = u'Internal JSON-RPC error.'
exception concurrent.core.transport.pyjsonrpc.rpcerror.InvalidParams(message=None, data=None)[source]

Bases: concurrent.core.transport.pyjsonrpc.rpcerror.JsonRpcError

code = -32602
message = u'Invalid method parameter(s).'
exception concurrent.core.transport.pyjsonrpc.rpcerror.InvalidRequest(message=None, data=None)[source]

Bases: concurrent.core.transport.pyjsonrpc.rpcerror.JsonRpcError

code = -32600
message = u'The JSON sent is not a valid Request object.'
exception concurrent.core.transport.pyjsonrpc.rpcerror.JsonRpcError(message=None, data=None)[source]

Bases: exceptions.RuntimeError

code = None
data = None
message = None
exception concurrent.core.transport.pyjsonrpc.rpcerror.MethodNotFound(message=None, data=None)[source]

Bases: concurrent.core.transport.pyjsonrpc.rpcerror.JsonRpcError

code = -32601
message = u'The method does not exist / is not available.'
exception concurrent.core.transport.pyjsonrpc.rpcerror.ParseError(message=None, data=None)[source]

Bases: concurrent.core.transport.pyjsonrpc.rpcerror.JsonRpcError

code = -32700
message = u'Invalid JSON was received by the server.'

concurrent.core.transport.pyjsonrpc.rpcjson module

concurrent.core.transport.pyjsonrpc.rpclib module

class concurrent.core.transport.pyjsonrpc.rpclib.JsonRpc(methods=None)[source]

Bases: object

JSON-RPC

call(json_request)[source]

Parses the json_request, calls the function(s) and returns the json_response.

Parameters:json_request – JSON-RPC-string with one or more JSON-RPC-requests
Returns:JSON-RPC-string with one or more responses.
system_describe()[source]

Returns a system description

See: http://web.archive.org/web/20100718181845/http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html#ServiceDescription

concurrent.core.transport.pyjsonrpc.rpcrequest module

class concurrent.core.transport.pyjsonrpc.rpcrequest.Request(jsonrpc=None, method=None, id=None, params=None)[source]

Bases: bunch.Bunch

JSON-RPC-Request

get_splitted_params()[source]

Split positional and named params

Returns:positional_params, named_params
concurrent.core.transport.pyjsonrpc.rpcrequest.create_request_dict(method, *args, **kwargs)[source]

Returns a JSON-RPC-Dictionary for a method

Parameters:
  • method – Name of the method
  • args – Positional parameters
  • kwargs – Named parameters
concurrent.core.transport.pyjsonrpc.rpcrequest.create_request_json(method, *args, **kwargs)[source]

Returns a JSON-RPC-String for a method

Parameters:
  • method – Name of the method
  • args – Positional parameters
  • kwargs – Named parameters
concurrent.core.transport.pyjsonrpc.rpcrequest.parse_request_json(json_string)[source]

Returns RPC-request as dictionary or as list with requests

concurrent.core.transport.pyjsonrpc.rpcresponse module

class concurrent.core.transport.pyjsonrpc.rpcresponse.Response(jsonrpc=None, id=None, result=None, error=None)[source]

Bases: bunch.Bunch

Represents a JSON-RPC-response.

class Error(code, message, data)[source]

Bases: bunch.Bunch

classmethod Response.from_dict(response_dict)[source]

Returns a Response-object, created from dictionary

Response.to_dict()[source]

Returns the response object as dictionary.

concurrent.core.transport.pyjsonrpc.rpcresponse.parse_response_json(json_string)[source]

Returns a RPC-Response or a list with RPC-Responses

Module contents