rest_server.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:loopchain 作者: theloopkr 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号