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

Replace CGetURLOpener with urlretrieve #105

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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.

@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.

None yet

3 participants