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

fix: enviroment variable PYTHONHTTPSVERIFY isn't take in consideration on https requests. #6693

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/requests/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
and maintain connections.
"""

import os
import os.path
import socket # noqa: F401
import typing
Expand Down Expand Up @@ -522,7 +523,14 @@ def send(
conn = self._get_connection(request, verify, proxies=proxies, cert=cert)
except LocationValueError as e:
raise InvalidURL(e, request=request)


python_https_verify = '1'
if 'PYTHONHTTPSVERIFY' in os.environ:
python_https_verify = os.environ['PYTHONHTTPSVERIFY']
if ((python_https_verify is None) or (python_https_verify == '') or (python_https_verify != '0') or (python_https_verify != '1')):
python_https_verify = '0'
verify = True if python_https_verify == '1' else False

self.cert_verify(conn, request.url, verify, cert)
url = self.request_url(request, proxies)
self.add_headers(
Expand Down