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

Function call_with_auth

test/functional/rpc_users.py:24–33  ·  view source on GitHub ↗
(node, user, password)

Source from the content-addressed store, hash-verified

22
23
24def call_with_auth(node, user, password):
25 url = urllib.parse.urlparse(node.url)
26 headers = {"Authorization": "Basic " + str_to_b64str('{}:{}'.format(user, password))}
27
28 conn = http.client.HTTPConnection(url.hostname, url.port)
29 conn.connect()
30 conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
31 resp = conn.getresponse()
32 conn.close()
33 return resp
34
35
36class HTTPBasicsTest(BitcoinTestFramework):

Callers 1

test_authMethod · 0.85

Calls 5

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

Tested by 1

test_authMethod · 0.68