mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-16 03:18:09 +00:00
Merge pull request #29 from jhoenicke/master
Verify the localback.net certificate
This commit is contained in:
commit
66cf46d7c5
@ -24,11 +24,11 @@ class BridgeTransport(Transport):
|
||||
|
||||
self.conn = requests.Session();
|
||||
|
||||
r = self.conn.post(TREZORD_HOST + '/configure', data=config, verify=None)
|
||||
r = self.conn.post(TREZORD_HOST + '/configure', data=config)
|
||||
if r.status_code != 200:
|
||||
raise Exception('trezord: Could not configure' + get_error(r))
|
||||
|
||||
r = self.conn.get(TREZORD_HOST + '/enumerate', verify=None)
|
||||
r = self.conn.get(TREZORD_HOST + '/enumerate')
|
||||
if r.status_code != 200:
|
||||
raise Exception('trezord: Could not enumerate devices' + get_error(r))
|
||||
enum = r.json()
|
||||
@ -43,14 +43,14 @@ class BridgeTransport(Transport):
|
||||
super(BridgeTransport, self).__init__(device, *args, **kwargs)
|
||||
|
||||
def _open(self):
|
||||
r = self.conn.post(TREZORD_HOST + '/acquire/%s' % self.path, verify=None)
|
||||
r = self.conn.post(TREZORD_HOST + '/acquire/%s' % self.path)
|
||||
if r.status_code != 200:
|
||||
raise Exception('trezord: Could not acquire session' + get_error(r))
|
||||
resp = r.json()
|
||||
self.session = resp['session']
|
||||
|
||||
def _close(self):
|
||||
r = self.conn.post(TREZORD_HOST + '/release/%s' % self.session, verify=None)
|
||||
r = self.conn.post(TREZORD_HOST + '/release/%s' % self.session)
|
||||
if r.status_code != 200:
|
||||
raise Exception('trezord: Could not release session' + get_error(r))
|
||||
else:
|
||||
@ -63,7 +63,7 @@ class BridgeTransport(Transport):
|
||||
cls = protobuf_msg.__class__.__name__
|
||||
msg = protobuf_json.pb2json(protobuf_msg)
|
||||
payload = '{"type": "%s", "message": %s}' % (cls, json.dumps(msg))
|
||||
r = self.conn.post(TREZORD_HOST + '/call/%s' % self.session, data=payload, verify=None)
|
||||
r = self.conn.post(TREZORD_HOST + '/call/%s' % self.session, data=payload)
|
||||
if r.status_code != 200:
|
||||
raise Exception('trezord: Could not write message' + get_error(r))
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user