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

pull/1/head
nelisky 9 years ago
parent f74d31788c
commit e4429242aa

@ -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']

Loading…
Cancel
Save