verify parameter name changed to verify_ssl_certs
This commit is contained in:
parent
13efdb967c
commit
4adef4de8a
|
@ -23,10 +23,10 @@ class JSONRPCDaemon(object):
|
||||||
:param port: port number
|
:param port: port number
|
||||||
:param path: path for JSON RPC requests (should not be changed)
|
:param path: path for JSON RPC requests (should not be changed)
|
||||||
:param timeout: request timeout
|
:param timeout: request timeout
|
||||||
:param timeout: request verify
|
:param verify_ssl_certs: verify ssl certs for request
|
||||||
"""
|
"""
|
||||||
def __init__(self, protocol='http', host='127.0.0.1', port=18081, path='/json_rpc',
|
def __init__(self, protocol='http', host='127.0.0.1', port=18081, path='/json_rpc',
|
||||||
user='', password='', timeout=30, verify=True):
|
user='', password='', timeout=30, verify_ssl_certs=True):
|
||||||
self.url = '{protocol}://{host}:{port}'.format(
|
self.url = '{protocol}://{host}:{port}'.format(
|
||||||
protocol=protocol,
|
protocol=protocol,
|
||||||
host=host,
|
host=host,
|
||||||
|
@ -35,7 +35,7 @@ class JSONRPCDaemon(object):
|
||||||
self.user = user
|
self.user = user
|
||||||
self.password = password
|
self.password = password
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.verify = verify
|
self.verify_ssl_certs = verify_ssl_certs
|
||||||
|
|
||||||
def info(self):
|
def info(self):
|
||||||
info = self.raw_jsonrpc_request('get_info')
|
info = self.raw_jsonrpc_request('get_info')
|
||||||
|
@ -68,7 +68,8 @@ class JSONRPCDaemon(object):
|
||||||
path=path,
|
path=path,
|
||||||
data=json.dumps(data, indent=2, sort_keys=True)))
|
data=json.dumps(data, indent=2, sort_keys=True)))
|
||||||
rsp = requests.post(
|
rsp = requests.post(
|
||||||
self.url + path, headers=hdr, data=json.dumps(data), timeout=self.timeout, verify=self.verify)
|
self.url + path, headers=hdr, data=json.dumps(data),
|
||||||
|
timeout=self.timeout, verify_ssl_certs=self.verify_ssl_certs)
|
||||||
if rsp.status_code != 200:
|
if rsp.status_code != 200:
|
||||||
raise RPCError("Invalid HTTP status {code} for path {path}.".format(
|
raise RPCError("Invalid HTTP status {code} for path {path}.".format(
|
||||||
code=rsp.status_code,
|
code=rsp.status_code,
|
||||||
|
@ -88,7 +89,8 @@ class JSONRPCDaemon(object):
|
||||||
auth = requests.auth.HTTPDigestAuth(self.user, self.password)
|
auth = requests.auth.HTTPDigestAuth(self.user, self.password)
|
||||||
rsp = requests.post(
|
rsp = requests.post(
|
||||||
self.url + '/json_rpc', headers=hdr, data=json.dumps(data), auth=auth,
|
self.url + '/json_rpc', headers=hdr, data=json.dumps(data), auth=auth,
|
||||||
timeout=self.timeout, verify=self.verify)
|
timeout=self.timeout, verify_ssl_certs=self.verify_ssl_certs)
|
||||||
|
|
||||||
if rsp.status_code == 401:
|
if rsp.status_code == 401:
|
||||||
raise Unauthorized("401 Unauthorized. Invalid RPC user name or password.")
|
raise Unauthorized("401 Unauthorized. Invalid RPC user name or password.")
|
||||||
elif rsp.status_code != 200:
|
elif rsp.status_code != 200:
|
||||||
|
@ -119,12 +121,12 @@ class JSONRPCWallet(object):
|
||||||
:param user: username to authenticate with over RPC
|
:param user: username to authenticate with over RPC
|
||||||
:param password: password to authenticate with over RPC
|
:param password: password to authenticate with over RPC
|
||||||
:param timeout: request timeout
|
:param timeout: request timeout
|
||||||
:param verify: request verify
|
:param verify_ssl_certs: verify ssl certs for request
|
||||||
"""
|
"""
|
||||||
_master_address = None
|
_master_address = None
|
||||||
|
|
||||||
def __init__(self, protocol='http', host='127.0.0.1', port=18088, path='/json_rpc',
|
def __init__(self, protocol='http', host='127.0.0.1', port=18088, path='/json_rpc',
|
||||||
user='', password='', timeout=30, verify=True):
|
user='', password='', timeout=30, verify_ssl_certs=True):
|
||||||
self.url = '{protocol}://{host}:{port}/json_rpc'.format(
|
self.url = '{protocol}://{host}:{port}/json_rpc'.format(
|
||||||
protocol=protocol,
|
protocol=protocol,
|
||||||
host=host,
|
host=host,
|
||||||
|
@ -133,7 +135,7 @@ class JSONRPCWallet(object):
|
||||||
self.user = user
|
self.user = user
|
||||||
self.password = password
|
self.password = password
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.verify = verify
|
self.verify_ssl_certs = verify_ssl_certs
|
||||||
_log.debug("JSONRPC wallet backend auth: '{user}'/'{stars}'".format(
|
_log.debug("JSONRPC wallet backend auth: '{user}'/'{stars}'".format(
|
||||||
user=user, stars=('*' * len(password)) if password else ''))
|
user=user, stars=('*' * len(password)) if password else ''))
|
||||||
|
|
||||||
|
@ -354,7 +356,9 @@ class JSONRPCWallet(object):
|
||||||
params=json.dumps(params, indent=2, sort_keys=True)))
|
params=json.dumps(params, indent=2, sort_keys=True)))
|
||||||
auth = requests.auth.HTTPDigestAuth(self.user, self.password)
|
auth = requests.auth.HTTPDigestAuth(self.user, self.password)
|
||||||
rsp = requests.post(
|
rsp = requests.post(
|
||||||
self.url, headers=hdr, data=json.dumps(data), auth=auth, timeout=self.timeout, verify=self.verify)
|
self.url, headers=hdr, data=json.dumps(data), auth=auth,
|
||||||
|
timeout=self.timeout, verify_ssl_certs=self.verify_ssl_certs)
|
||||||
|
|
||||||
if rsp.status_code == 401:
|
if rsp.status_code == 401:
|
||||||
raise Unauthorized("401 Unauthorized. Invalid RPC user name or password.")
|
raise Unauthorized("401 Unauthorized. Invalid RPC user name or password.")
|
||||||
elif rsp.status_code != 200:
|
elif rsp.status_code != 200:
|
||||||
|
|
Loading…
Reference in New Issue