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

Function rpccall

test/functional/rpc_whitelist.py:18–26  ·  view source on GitHub ↗
(node, user, method)

Source from the content-addressed store, hash-verified

16import urllib.parse
17
18def rpccall(node, user, method):
19 url = urllib.parse.urlparse(node.url)
20 headers = {"Authorization": "Basic " + str_to_b64str('{}:{}'.format(user[0], user[3]))}
21 conn = http.client.HTTPConnection(url.hostname, url.port)
22 conn.connect()
23 conn.request('POST', '/', '{"method": "' + method + '"}', headers)
24 resp = conn.getresponse()
25 conn.close()
26 return resp
27
28
29class RPCWhitelistTest(BitcoinTestFramework):

Callers 1

run_testMethod · 0.85

Calls 5

str_to_b64strFunction · 0.90
formatMethod · 0.80
connectMethod · 0.80
requestMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected