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

Call prepared request with env. Variable to Use http proxy #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GyoOkuda
Copy link

@GyoOkuda GyoOkuda commented Feb 16, 2021

Currently, openapi3 doesn't honor HTTP_PROXY/HTTPS_PROXY environment variable.
and, no another way to set http proxy / ca_bundle in openapi3.

As Described in psf/requests#2807 (comment) , to honor environment variable, environment setting dict should be taken from requests.Session.merge_environment_settings , and requests.Session.send should be called with it.

@Dorthu
Copy link
Owner

Dorthu commented Jul 12, 2021

I believe all of these settings can be specified on the Session object directly; after #39 I think a better solution would be something like this:

def my_session_factory() -> requests.Session:
  session = requests.Session()
  session.verify = True
  session.proxy = "https://some.proxy.org"
  session.cert = ("/path/to/cert", "/path/to/key")
  return session

spec = OpenAPI(some_yaml, session_factory=my_session_factory)

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.

2 participants