Skip to content

Commit f695eaf

Browse files
author
wilmeryan
committed
bump sypht==0.5.11 and refactor SyphtClient.requests session
1 parent 010aefe commit f695eaf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from setuptools import find_packages, setup
22

3-
__version__ = "0.5.10"
3+
__version__ = "0.5.11"
44
__pkg_name__ = "sypht"
55

66
setup(

sypht/client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ def __init__(
3535
:param base_endpoint: Sypht API endpoint. Default: `https://api.sypht.com`.
3636
:param auth_endpoint: Sypht authentication endpoint. Default: `https://login.sypht.com/oauth/token`.
3737
"""
38-
self.requests = session if session is not None else requests.Session()
3938
self.base_endpoint = base_endpoint or os.environ.get(
4039
"SYPHT_API_BASE_ENDPOINT", SYPHT_API_BASE_ENDPOINT
4140
)
4241
self.audience = os.environ.get("SYPHT_AUDIENCE", self.base_endpoint)
4342
self.auth_endpoint = auth_endpoint or os.environ.get(
4443
"SYPHT_AUTH_ENDPOINT", SYPHT_AUTH_ENDPOINT
4544
)
45+
self.requests = session if session is not None else self._create_session
4646

4747
if client_id is None and client_secret is None:
4848
env_key = os.environ.get(self.API_ENV_KEY)
@@ -70,6 +70,10 @@ def __init__(
7070
self._company_id = None
7171
self._authenticate_client()
7272

73+
@property
74+
def _create_session(self):
75+
return requests.Session()
76+
7377
@staticmethod
7478
def _authenticate_v2(endpoint, client_id, client_secret, audience):
7579
basic_auth_slug = b64encode((client_id + ":" + client_secret).encode("utf-8")).decode(

0 commit comments

Comments
 (0)