fastcore
fastcore copied to clipboard
[question] Best way to update user-agent used in net.py/urlretrieve?
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?)