MCPcopy Create free account
hub / github.com/ElementsProject/elements / execute

Method execute

contrib/linearize/linearize-hashes.py:32–49  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

30 self.conn = HTTPConnection(host, port=port, timeout=30)
31
32 def execute(self, obj):
33 try:
34 self.conn.request('POST', '/', json.dumps(obj),
35 { 'Authorization' : self.authhdr,
36 'Content-type' : 'application/json' })
37 except ConnectionRefusedError:
38 print('RPC connection refused. Check RPC settings and the server status.',
39 file=sys.stderr)
40 return None
41
42 resp = self.conn.getresponse()
43 if resp is None:
44 print("JSON-RPC: no response", file=sys.stderr)
45 return None
46
47 body = resp.read().decode('utf-8')
48 resp_obj = json.loads(body)
49 return resp_obj
50
51 @staticmethod
52 def build_request(idx, method, params):

Callers 1

get_block_hashesFunction · 0.95

Calls 3

requestMethod · 0.80
decodeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected