From b0f2d43884339c206f685f22203804e303430f87 Mon Sep 17 00:00:00 2001 From: Andrew Kozlik Date: Wed, 1 Dec 2021 14:17:19 +0100 Subject: [PATCH] tests: Fix tx_cache download. --- tests/tx_cache.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/tx_cache.py b/tests/tx_cache.py index e5cea666e..2a14fd4e0 100755 --- a/tests/tx_cache.py +++ b/tests/tx_cache.py @@ -107,7 +107,10 @@ def cli(tx, coin_name): click.echo(f"Fetching from {tx_url}...") 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_dict = protobuf.to_dict(tx_proto) tx_json = json.dumps(tx_dict, sort_keys=True, indent=2) + "\n"