Skip to content

Conversation

@SharkFishDeveloper
Copy link
Contributor

Fixes #2554

Some external services reject requests made by Cog when fetching input URLs
because the default python-requests User-Agent is blocked or disallowed.

Previously, Cog used requests.get() without any way for users to configure
request headers. This caused URL fetches to fail for certain providers.

This change allows users to configure the User-Agent via an environment
variable (COG_USER_AGENT). If the variable is set, it is included in the
request headers; otherwise, the existing behavior remains unchanged.

This provides a simple, backward-compatible way to avoid request rejections
without modifying Cog internals or re-hosting input files.

@michaeldwan
Copy link
Member

Nice improvement! I'm good moving it forward once we add an integration test. @markphelps can you do that?

@markphelps
Copy link
Contributor

Nice improvement! I'm good moving it forward once we add an integration test. @markphelps can you do that?

I can in a bit. @SharkFishDeveloper this looks like it also contains the fix in #2619 . Can we rebase this onto main instead without that change since its in another PR?

@SharkFishDeveloper SharkFishDeveloper force-pushed the fix/configurable-user-agent branch from e21492c to 81b4f06 Compare January 16, 2026 15:29
@SharkFishDeveloper
Copy link
Contributor Author

Thanks for pointing that out. I’ve cleaned this up by rebasing onto main and keeping only the User-Agent change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

please make user agent string configurable

3 participants