Access to HttpRequest¶
RPC4Django allows RPC methods to be written in such a way that they have access to Django’s HttpRequest object. This can be used to see the type of request, the user making the request or any specific headers in the request object. To use this, the first argument have to be named “request” like classic django view function.
@rpcmethod(name='rpc4django.httprequest',signature=['string']) def httprequest(request): ''' Illustrates access to the HttpRequest object ''' return str(request)