1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +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:
raise Exception('Unknown script opcode: %s' % opcode)
def insight_tx(url):
try:
f = urllib2.urlopen(url)
except:
raise Exception('URL error: %s' % url)
data = json.load(f)
def insight_tx(url, rawdata=False):
if not rawdata:
try:
f = urllib2.urlopen(url)
data = json.load(f)
except:
raise Exception('URL error: %s' % url)
else:
data = url
t = proto_types.TransactionType()
t.version = data['version']