1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 23:08:14 +00:00

tests: Fix tx_cache download.

This commit is contained in:
Andrew Kozlik 2021-12-01 14:17:19 +01:00 committed by Andrew Kozlik
parent e9fd1fc49f
commit b0f2d43884

View File

@ -107,7 +107,10 @@ def cli(tx, coin_name):
click.echo(f"Fetching from {tx_url}...") click.echo(f"Fetching from {tx_url}...")
try: try:
tx_src = requests.get(tx_url).json(parse_float=Decimal) # Get transaction from Blockbook server. The servers refuse requests with an empty user agent.
tx_src = requests.get(tx_url, headers={"user-agent": "tx_cache"}).json(
parse_float=Decimal
)
tx_proto = btc.from_json(tx_src) tx_proto = btc.from_json(tx_src)
tx_dict = protobuf.to_dict(tx_proto) tx_dict = protobuf.to_dict(tx_proto)
tx_json = json.dumps(tx_dict, sort_keys=True, indent=2) + "\n" tx_json = json.dumps(tx_dict, sort_keys=True, indent=2) + "\n"