Skip to content

requests: Support SSL_CERT_FILE environment variable #2899

Description

@thoger

Requests allows setting path to a CA certificate bundle that should be used instead of the default system one using the following environment variables: REQUESTS_CA_BUNDLE and CURL_CA_BUNDLE.

https://github.com/kennethreitz/requests/blob/v2.8.1/requests/sessions.py#L621

Please make it also check SSL_CERT_FILE environment variable in the same way. This variable is recognized by OpenSSL and is documented in PEP 476 as a way to make Python standard library https clients use non-default CA bundle file:

https://www.python.org/dev/peps/pep-0476/#trust-database

It sounds reasonable to have a single environment variable that can be used for all Python scripts regardless of whether they are using requests or standard library httplib / urllib*.

In terms of the fix, a simple or os.environ.get('SSL_CERT_FILE') should do the trick.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions