diff --git a/monero/backends/jsonrpc.py b/monero/backends/jsonrpc.py index c79f692..5ba8802 100644 --- a/monero/backends/jsonrpc.py +++ b/monero/backends/jsonrpc.py @@ -25,7 +25,7 @@ class JSONRPCDaemon(object): :param timeout: request timeout """ def __init__(self, protocol='http', host='127.0.0.1', port=18081, path='/json_rpc', - user='', password='', timeout=30): + user='', password='', timeout=30, verify=True): self.url = '{protocol}://{host}:{port}'.format( protocol=protocol, host=host, @@ -34,6 +34,7 @@ class JSONRPCDaemon(object): self.user = user self.password = password self.timeout = timeout + self.verify = verify def info(self): info = self.raw_jsonrpc_request('get_info') @@ -66,7 +67,7 @@ class JSONRPCDaemon(object): path=path, data=json.dumps(data, indent=2, sort_keys=True))) rsp = requests.post( - self.url + path, headers=hdr, data=json.dumps(data), timeout=self.timeout) + self.url + path, headers=hdr, data=json.dumps(data), timeout=self.timeout, verify=self.verify) if rsp.status_code != 200: raise RPCError("Invalid HTTP status {code} for path {path}.".format( code=rsp.status_code, @@ -86,7 +87,7 @@ class JSONRPCDaemon(object): auth = requests.auth.HTTPDigestAuth(self.user, self.password) rsp = requests.post( self.url + '/json_rpc', headers=hdr, data=json.dumps(data), auth=auth, - timeout=self.timeout) + timeout=self.timeout, verify=self.verify) if rsp.status_code == 401: raise Unauthorized("401 Unauthorized. Invalid RPC user name or password.") elif rsp.status_code != 200: @@ -121,7 +122,7 @@ class JSONRPCWallet(object): _master_address = None def __init__(self, protocol='http', host='127.0.0.1', port=18088, path='/json_rpc', - user='', password='', timeout=30): + user='', password='', timeout=30, verify=True): self.url = '{protocol}://{host}:{port}/json_rpc'.format( protocol=protocol, host=host, @@ -130,6 +131,7 @@ class JSONRPCWallet(object): self.user = user self.password = password self.timeout = timeout + self.verify = verify _log.debug("JSONRPC wallet backend auth: '{user}'/'{stars}'".format( user=user, stars=('*' * len(password)) if password else '')) @@ -350,7 +352,7 @@ class JSONRPCWallet(object): params=json.dumps(params, indent=2, sort_keys=True))) auth = requests.auth.HTTPDigestAuth(self.user, self.password) rsp = requests.post( - self.url, headers=hdr, data=json.dumps(data), auth=auth, timeout=self.timeout) + self.url, headers=hdr, data=json.dumps(data), auth=auth, timeout=self.timeout, verify=self.verify) if rsp.status_code == 401: raise Unauthorized("401 Unauthorized. Invalid RPC user name or password.") elif rsp.status_code != 200: