Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] Best way to update user-agent used in net.py/urlretrieve? #513

Open
castorfou opened this issue Jan 26, 2023 · 0 comments
Open

Comments

@castorfou
Copy link

Network requests in my corporate network are filtered.
And if user-agent is flagged as 'too old', request is rejected (error 503)

In net.py, there is a user-agent setup at Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36

When calling path = untar_data(URLs.MNIST_SAMPLE) for example, I got this 503 error.
By updating url_default_headers['User-Agent'] with Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 (the one from my corporate browser) directly in net.py, I got the MNIST data

Is there a way to update smoothly this user-agent (env varible? or anything else?)

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

No branches or pull requests

1 participant