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

Function call_with_auth

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

Source from the content-addressed store, hash-verified

22
23
24def call_with_auth(node, user, password, method="getbestblockhash"):
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', '/', f'{{"method": "{method}"}}', headers)
31 resp = conn.getresponse()
32 conn.close()
33 return resp
34
35
36class HTTPBasicsTest(BitcoinTestFramework):

Callers 3

test_authMethod · 0.85
test_norpccookiefileMethod · 0.85
run_testMethod · 0.85

Calls 5

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

Tested by 2

test_authMethod · 0.68
test_norpccookiefileMethod · 0.68