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

introduce HTTPX_CA_BUNDLE, fix docs #3510

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

Conversation

Yanpas
Copy link

@Yanpas Yanpas commented Feb 20, 2025

Summary

HTTPX_CA_BUNDLE env-variable was introduced (similar to REQUESTS_CA_BUNDLE). The motivation behind it: SSL_CERT_FILE affects other libraries/programs.

Alternatively I can introduce HTTPX_SYSTEM_CA.

Related to #302

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

@Yanpas
Copy link
Author

Yanpas commented Feb 20, 2025

Also current documentation is misleading

@salman1993
Copy link

httpx docs suggest that they do not automatically pull in the environment variables SSL_CERT_FILE -
https://www.python-httpx.org/advanced/ssl/#working-with-ssl_cert_file-and-ssl_cert_dir

the code suggests that those env vars do get picked up:

httpx/httpx/_config.py

Lines 33 to 37 in e70d0b0

if verify is True:
if trust_env and os.environ.get("SSL_CERT_FILE"): # pragma: nocover
ctx = ssl.create_default_context(cafile=os.environ["SSL_CERT_FILE"])
elif trust_env and os.environ.get("SSL_CERT_DIR"): # pragma: nocover
ctx = ssl.create_default_context(capath=os.environ["SSL_CERT_DIR"])

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