pytan3.http_client.
Certify
(http_client, lvl='info')[source]¶Bases: object
Certificate verification magic.
__init__
(http_client, lvl='info')[source]¶Constructor.
Parameters: |
|
---|
log
= None¶logging.Logger
– Logger for this object.
http_client
= None¶HttpClient
– Client for this object.
__call__
(path=None, path_sub='certs', path_file='{http_client.parsed_url.hostname}.pem', verify_hook=None, overwrite=False, lvl=None)[source]¶Validate, find, or get certificate for URL.
Parameters: |
|
---|---|
Raises: |
|
write_pem
(path, overwrite=False)[source]¶Write a certificate in PEM format to disk.
Parameters: |
|
---|---|
Returns: |
verify_hook
(store, store_chain, parsed_url)[source]¶Verify cert by prompting user, default hook.
Parameters: |
|
---|---|
Raises: |
|
store
¶Get CertStore for URL.
Returns: | cert_human.CertStore |
---|
store_chain
¶Get CertChainStore for URL.
Returns: | cert_human.CertChainStore |
---|
_fetch_stores
¶Get the CertStore and CertChainStore for URL.
Returns: | (cert_human.CertStore , cert_human.CertChainStore ) |
---|
check_default
()[source]¶Check if cert for URL is valid without setting a specific path.
Returns: | bool |
---|
check_path
(path)[source]¶Check if cert at path is valid for URL.
Parameters: | path (str or pathlib.Path ) – Path to PEM certificate file. |
---|
Notes
If validation is successful, the verify attribute on
HttpClient.session
will be set to path.
Raises: | exceptions.CertificateInvalidError – If path fails verification. |
---|