Skip to content

Conversation

@pcf000
Copy link

@pcf000 pcf000 commented Jun 23, 2022

For reasons I have not entirely traced, URLopener (and thus FancyURLopener) does not work with some proxies. I can see that instead of setting up a tunnel with a CONNECT request, it makes a GET request to the proxy, which in my case induces a 502-bad-gateway response. Even though it recognises the proxy settings, it doesn't quite do the right thing.

However, urlopen uses ProxyHandler to accommodate the situation, and does work through this troublesome proxy. urllib.request.urlretrieve has the same interface as URLopener.retrieve, and seems like a drop-in replacement. I added a try/except around the urlretrieve to get the BuildError for responses of 400 or greater, since there is no longer a custom http_error_default or a good place to hang it.

This change addresses my internal build problem and probably also issues #52 and #77. Plus, no more deprecation warnings.

@pcf000 pcf000 force-pushed the use-urlretrieve branch from a24319c to 5ab9f18 Compare May 2, 2023 18:07
@giuseros
Copy link

giuseros commented Dec 6, 2023

Hi @pfultz2 , may I ask why this is not merged yet? It certainly sorted the issues I was facing with an internal proxy :)!

@pfultz2
Copy link
Owner

pfultz2 commented Dec 6, 2023

There is failures in ubuntu CI, if you can merge the latest from master which updated it to 20.04.

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.

3 participants