1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-17 01:52:02 +00:00

Allow insight_tx to be passed a dict object instead of an url

This commit is contained in:
nelisky 2015-03-03 23:36:51 +00:00
parent f74d31788c
commit e4429242aa

View File

@ -52,12 +52,15 @@ def opcode_serialize(opcode):
except: except:
raise Exception('Unknown script opcode: %s' % opcode) raise Exception('Unknown script opcode: %s' % opcode)
def insight_tx(url): def insight_tx(url, rawdata=False):
try: if not rawdata:
f = urllib2.urlopen(url) try:
except: f = urllib2.urlopen(url)
raise Exception('URL error: %s' % url) data = json.load(f)
data = json.load(f) except:
raise Exception('URL error: %s' % url)
else:
data = url
t = proto_types.TransactionType() t = proto_types.TransactionType()
t.version = data['version'] t.version = data['version']