From fe802ba253b25ee5fb93425ed5e4fc2406b9f755 Mon Sep 17 00:00:00 2001 From: Vlad Radulescu Date: Wed, 25 Feb 2026 23:22:11 +0200 Subject: [PATCH] Force a User-Agent string that is NOT the default Python-urlib. This led to the connection being dropped. --- tockloader/tab.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tockloader/tab.py b/tockloader/tab.py index d40d0e3..8f3cbc3 100644 --- a/tockloader/tab.py +++ b/tockloader/tab.py @@ -33,7 +33,11 @@ def __init__(self, tab_path, args=argparse.Namespace()): else: try: # Otherwise download it as a URL. - with urllib.request.urlopen(tab_path) as response: + request = urllib.request.Request( + tab_path, + headers={"User-Agent": "tockloader"}, + ) + with urllib.request.urlopen(request) as response: tmp_file = tempfile.TemporaryFile() # Copy the downloaded response to our temporary file. shutil.copyfileobj(response, tmp_file)