Start isolated docker setup.

This commit is contained in:
tecnovert
2020-12-27 21:39:10 +02:00
parent a6ead83fd2
commit d2ded157f8
20 changed files with 332 additions and 42 deletions

View File

@@ -4,10 +4,10 @@ import json
import requests
def callrpc_xmr(rpc_port, auth, method, params=[], path='json_rpc'):
def callrpc_xmr(rpc_port, auth, method, params=[], rpc_host='127.0.0.1', path='json_rpc'):
# auth is a tuple: (username, password)
try:
url = 'http://127.0.0.1:{}/{}'.format(rpc_port, path)
url = 'http://{}:{}/{}'.format(rpc_host, rpc_port, path)
request_body = {
'method': method,
'params': params,
@@ -51,20 +51,6 @@ def callrpc_xmr_na(rpc_port, method, params=[], rpc_host='127.0.0.1', path='json
return r['result']
def callrpc_xmr2(rpc_port, method, params=[]):
try:
url = 'http://127.0.0.1:{}/{}'.format(rpc_port, method)
headers = {
'content-type': 'application/json'
}
p = requests.post(url, data=json.dumps(params), headers=headers)
r = json.loads(p.text)
except Exception as ex:
raise ValueError('RPC Server Error: {}'.format(str(ex)))
return r
def make_xmr_rpc_func(port, host='127.0.0.1'):
port = port
host = host
@@ -76,11 +62,12 @@ def make_xmr_rpc_func(port, host='127.0.0.1'):
return rpc_func
def make_xmr_wallet_rpc_func(port, auth):
def make_xmr_wallet_rpc_func(port, auth, host='127.0.0.1'):
port = port
auth = auth
host = host
def rpc_func(method, params=None, wallet=None):
nonlocal port, auth
return callrpc_xmr(port, auth, method, params)
nonlocal port, auth, host
return callrpc_xmr(port, auth, method, params, rpc_host=host)
return rpc_func