#NEWLINE# def callRemote( self , method , * args , **kwargs ) : #NEWLINE# #INDENT# "\n        Remotely calls the method, with args. Given that we keep reference to\n        the call via the Deferred, there's no need for id. It will coin some\n        random anyway, just to satisfy the spec.\n\n        @type method: str\n        @param method: Method name\n\n        @type *args: list\n        @param *args: List of agruments for the method.\n\n        @rtype: t.i.d.Deferred\n        @return: Deferred, that will fire with whatever the 'method' returned.\n        @TODO support batch requests\n        " #NEWLINE# if kwargs : #NEWLINE# #INDENT# json_request = jsonrpc . encodeRequest ( method , kwargs , version = self . version ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# json_request = jsonrpc . encodeRequest ( method , args , version = self . version ) #NEWLINE# #UNINDENT# body = StringProducer ( json_request ) #NEWLINE# headers_dict = { #NEWLINE# #INDENT# 'Content-Type' : [ 'application/json' ] , #NEWLINE# #UNINDENT# } #NEWLINE# if ( not isinstance ( self . credentials , Anonymous ) ) : #NEWLINE# #INDENT# headers_dict . update ( self . _getBasicHTTPAuthHeaders ( ) ) #NEWLINE# #UNINDENT# headers = Headers ( self ) #NEWLINE# d = self . agent . request ( 'POST' , self . url , headers , body ) #NEWLINE# d . addCallback ( self . checkAuthError ) #NEWLINE# d . addCallback ( self . bodyFromResponse ) #NEWLINE# d . addCallback ( jsonrpc . decodeResponse ) #NEWLINE# return d