Base classes

class djangorpc.router.RpcRouter(actions={}, url_namespace=None, enable_buffer=True)[source]

Bases: object

Router class for RPC.

  • url_namespace – URL pattern namespace where router insance is included. Used to get URL which router is connected.
  • actions – Action classes router should add to RPC API
  • enable_buffer – Define client should send requests in a batch
action_extra_kwargs(action, request, *args, **kwargs)[source]

Check maybe this action get some extra arguments from request

method_extra_kwargs(method, request, *args, **kwargs)[source]

Check maybe this method get some extra arguments from request

extra_kwargs(request, *args, **kwargs)[source]

For all method in ALL actions we add request.user to arguments. You can add something else, request for example. For adding extra arguments for one action use action_extra_kwargs.

api(request, *args, **kwargs)[source]

This method is view that send js for provider initialization. Just set this in template after RPC scripts including: <script src=”{% url api_url_name %}”></script>

call_action(rd, request, *args, **kwargs)[source]

This method checks parameters of RPC request and call method of action. It checks arguments number, method existing, handle RpcExceptionEvent and send exception event for RPC.

class djangorpc.router.RpcRouterJSONEncoder(url_args, url_kwargs, *args, **kwargs)[source]

Bases: json.encoder.JSONEncoder

JSON Encoder for RpcRouter