MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / __call__

Method __call__

test/functional/test_framework/authproxy.py:126–151  ·  view source on GitHub ↗
(self, *args, **argsn)

Source from the content-addressed store, hash-verified

124 'id': AuthServiceProxy.__id_count}
125
126 def __call__(self, *args, **argsn):
127 postdata = self._json_dumps(self.get_request(*args, **argsn))
128 response, status = self._request('POST', self.__url.path, postdata.encode('utf-8'))
129 # For backwards compatibility tests, accept JSON RPC 1.1 responses
130 if 'jsonrpc' not in response:
131 if response['error'] is not None:
132 raise JSONRPCException(response['error'], status)
133 elif 'result' not in response:
134 raise JSONRPCException({
135 'code': -343, 'message': 'missing JSON-RPC result'}, status)
136 elif status != HTTPStatus.OK:
137 raise JSONRPCException({
138 'code': -342, 'message': 'non-200 HTTP status code but no JSON-RPC error'}, status)
139 else:
140 return response['result']
141 else:
142 assert_equal(response['jsonrpc'], '2.0')
143 if status != HTTPStatus.OK:
144 raise JSONRPCException({
145 'code': -342, 'message': 'non-200 HTTP status code'}, status)
146 if 'error' in response:
147 raise JSONRPCException(response['error'], status)
148 elif 'result' not in response:
149 raise JSONRPCException({
150 'code': -343, 'message': 'missing JSON-RPC 2.0 result and error'}, status)
151 return response['result']
152
153 def batch(self, rpc_call_list):
154 postdata = self._json_dumps(list(rpc_call_list))

Callers

nothing calls this directly

Calls 6

_json_dumpsMethod · 0.95
get_requestMethod · 0.95
_requestMethod · 0.95
JSONRPCExceptionClass · 0.85
assert_equalFunction · 0.85
encodeMethod · 0.45

Tested by

no test coverage detected