cert_verify() — requests Function Reference
Architecture documentation for the cert_verify() function in adapters.py from the requests codebase.
Entity Profile
Dependency Diagram
graph TD f3317fc3_a2fa_ce2a_bb1a_4f53b0443c40["cert_verify()"] 5fdf5d52_8295_768a_e20f_c6cefb721b91["HTTPAdapter"] f3317fc3_a2fa_ce2a_bb1a_4f53b0443c40 -->|defined in| 5fdf5d52_8295_768a_e20f_c6cefb721b91 66fc1563_b020_b369_a505_bc9abe7cf66d["send()"] 66fc1563_b020_b369_a505_bc9abe7cf66d -->|calls| f3317fc3_a2fa_ce2a_bb1a_4f53b0443c40 43bfb55b_6419_5997_8140_872a62e09796["extract_zipped_paths()"] f3317fc3_a2fa_ce2a_bb1a_4f53b0443c40 -->|calls| 43bfb55b_6419_5997_8140_872a62e09796 style f3317fc3_a2fa_ce2a_bb1a_4f53b0443c40 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/requests/adapters.py lines 282–336
def cert_verify(self, conn, url, verify, cert):
"""Verify a SSL certificate. This method should not be called from user
code, and is only exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param conn: The urllib3 connection object associated with the cert.
:param url: The requested URL.
:param verify: Either a boolean, in which case it controls whether we verify
the server's TLS certificate, or a string, in which case it must be a path
to a CA bundle to use
:param cert: The SSL certificate to verify.
"""
if url.lower().startswith("https") and verify:
cert_loc = None
# Allow self-specified cert location.
if verify is not True:
cert_loc = verify
if not cert_loc:
cert_loc = extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH)
if not cert_loc or not os.path.exists(cert_loc):
raise OSError(
f"Could not find a suitable TLS CA certificate bundle, "
f"invalid path: {cert_loc}"
)
conn.cert_reqs = "CERT_REQUIRED"
if not os.path.isdir(cert_loc):
conn.ca_certs = cert_loc
else:
conn.ca_cert_dir = cert_loc
else:
conn.cert_reqs = "CERT_NONE"
conn.ca_certs = None
conn.ca_cert_dir = None
if cert:
if not isinstance(cert, basestring):
conn.cert_file = cert[0]
conn.key_file = cert[1]
else:
conn.cert_file = cert
conn.key_file = None
if conn.cert_file and not os.path.exists(conn.cert_file):
raise OSError(
f"Could not find the TLS certificate file, "
f"invalid path: {conn.cert_file}"
)
if conn.key_file and not os.path.exists(conn.key_file):
raise OSError(
f"Could not find the TLS key file, invalid path: {conn.key_file}"
)
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does cert_verify() do?
cert_verify() is a function in the requests codebase, defined in src/requests/adapters.py.
Where is cert_verify() defined?
cert_verify() is defined in src/requests/adapters.py at line 282.
What does cert_verify() call?
cert_verify() calls 1 function(s): extract_zipped_paths.
What calls cert_verify()?
cert_verify() is called by 1 function(s): send.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free