Skip to content

Commit 66cbe79

Browse files
committed
allow User-Agent to be set as BIOIMAGEIO_USER_AGENT env var
1 parent e9b232a commit 66cbe79

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bioimageio/spec/shared/_resolve_source.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,10 @@ def _download_url(uri: raw_nodes.URI, output: typing.Optional[os.PathLike] = Non
470470
if os.environ.get("CI", "false").lower() in ("1", "t", "true", "yes", "y"):
471471
headers["User-Agent"] = "ci"
472472

473+
user_agent = os.environ.get("BIOIMAGEIO_USER_AGENT")
474+
if user_agent is not None:
475+
headers["User-Agent"] = user_agent
476+
473477
r = requests.get(str(uri), stream=True, headers=headers)
474478
r.raise_for_status()
475479
# Total size in bytes.

0 commit comments

Comments
 (0)