def get(self):
args = ServerComponents().parser.parse_args()
response = ServerComponents().get_transaction(args['hash'], get_channel_name_from_args(args))
tx_data = json.loads('{}')
tx_data['response_code'] = str(response.response_code)
tx_data['data'] = ""
if len(response.data) is not 0:
try:
tx_data['data'] = json.loads(response.data)
except json.JSONDecodeError as e:
logging.warning("your data is not json, your data(" + str(response.data) + ")")
tx_data['data'] = response.data
tx_data['meta'] = ""
if len(response.meta) is not 0:
tx_data['meta'] = json.loads(response.meta)
tx_data['more_info'] = response.more_info
b64_sign = base64.b64encode(response.signature)
tx_data['signature'] = b64_sign.decode()
b64_public_key = base64.b64encode(response.public_key)
tx_data['public_key'] = b64_public_key.decode()
return tx_data
评论列表
文章目录