Skip to content

[REQ] Add proxy support via environment variables #6786

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

Open
apyrgio opened this issue Jun 25, 2020 · 3 comments
Open

[REQ] Add proxy support via environment variables #6786

apyrgio opened this issue Jun 25, 2020 · 3 comments

Comments

@apyrgio
Copy link

apyrgio commented Jun 25, 2020

Is your feature request related to a problem? Please describe.

Most programs detect that they must use a proxy by checking the http_proxy / https_proxy environment variables. See for example this section of requests on proxying: https://github.com/request/request#controlling-proxy-behaviour-using-environment-variables.

This is not the case here though, as the user must explicitly override the .proxy argument of the Configuration class, in order to enable proxying.

Describe the solution you'd like

The Configuration class should auto-detect the appropriate environment variables and pass them to urllib3, given that urllib3 has chosen not to do it (urllib3/urllib3#1785). If this proposal makes sense, I could open a PR.

(This issue was originally opened in kubernetes-client/python#1175)

@zeraphin21
Copy link

Agree with that, I figured out the same problem and was forced to override the proxy attribute.
We should have the possibility to set proxy when init Configuration class.

@JohannesHoppe
Copy link
Contributor

As a workaround, you can can try setting the networking properties using -D: https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html

e.g.

java -Dhttps.proxyHost=internal-proxy.mycompany.com -Dhttps.proxyPort=8080 -jar openapi-generator.jar generate -i https://api.mycompany.com/swagger.json -g typescript-angular -o ./api

The -D arguments must be placed before the -jar option!

@AlissonLorscheiterTR
Copy link

same problem with python3 using uvicorn project, calling requests method with urllib3 dependencies.

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

No branches or pull requests

4 participants