authproxy: Add support for RPC named arguments
This commit is contained in:
parent
406f35d99d
commit
5865d41f88
1 changed files with 4 additions and 2 deletions
|
@ -138,14 +138,16 @@ class AuthServiceProxy(object):
|
||||||
self.__conn.request(method, path, postdata, headers)
|
self.__conn.request(method, path, postdata, headers)
|
||||||
return self._get_response()
|
return self._get_response()
|
||||||
|
|
||||||
def __call__(self, *args):
|
def __call__(self, *args, **argsn):
|
||||||
AuthServiceProxy.__id_count += 1
|
AuthServiceProxy.__id_count += 1
|
||||||
|
|
||||||
log.debug("-%s-> %s %s"%(AuthServiceProxy.__id_count, self._service_name,
|
log.debug("-%s-> %s %s"%(AuthServiceProxy.__id_count, self._service_name,
|
||||||
json.dumps(args, default=EncodeDecimal, ensure_ascii=self.ensure_ascii)))
|
json.dumps(args, default=EncodeDecimal, ensure_ascii=self.ensure_ascii)))
|
||||||
|
if args and argsn:
|
||||||
|
raise ValueError('Cannot handle both named and positional arguments')
|
||||||
postdata = json.dumps({'version': '1.1',
|
postdata = json.dumps({'version': '1.1',
|
||||||
'method': self._service_name,
|
'method': self._service_name,
|
||||||
'params': args,
|
'params': args or argsn,
|
||||||
'id': AuthServiceProxy.__id_count}, default=EncodeDecimal, ensure_ascii=self.ensure_ascii)
|
'id': AuthServiceProxy.__id_count}, default=EncodeDecimal, ensure_ascii=self.ensure_ascii)
|
||||||
response = self._request('POST', self.__url.path, postdata.encode('utf-8'))
|
response = self._request('POST', self.__url.path, postdata.encode('utf-8'))
|
||||||
if response['error'] is not None:
|
if response['error'] is not None:
|
||||||
|
|
Loading…
Add table
Reference in a new issue