Skip to content

Commit 53b92c3

Browse files
committed
feat: Add the ability to pass a requests Session to Client
fixes #254
1 parent c930530 commit 53b92c3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cert_manager/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def __init__(self, **kwargs):
4040
auth_url: The full URL to the Sectigo OAuth2 token endpoint; the default is "https://auth.sso.sectigo.com/auth/realms/apiclients/protocol/openid-connect/token"
4141
client_id: The Client ID to use for OAuth2 authentication
4242
client_secret: The Client Secret to use for OAuth2 authentication
43+
session: A requests.Session object to use instead of creating a new one; the default is None,
44+
which will create a new session
4345
"""
4446
# Initialize class variables
4547
self._base_url = None
@@ -51,7 +53,8 @@ def __init__(self, **kwargs):
5153
self._user_key_file = None
5254
self._username = None
5355

54-
self._session = requests.Session()
56+
self._session = kwargs.get("session", requests.Session())
57+
5558
# Set the default HTTP headers
5659
self._headers = {
5760
"Accept": "application/json",

0 commit comments

Comments
 (0)