Skip to content

Commit 45a278f

Browse files
author
wilmeryan
committed
bump urllib and requests dependencies and reuse sessions for requests
1 parent f695eaf commit 45a278f

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
requests==2.22.0
1+
requests==2.26.0
2+
urllib3==1.26.0

setup.py

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

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

66
setup(
@@ -16,5 +16,5 @@
1616
"Programming Language :: Python :: 3.7",
1717
"Topic :: Scientific/Engineering :: Artificial Intelligence",
1818
],
19-
install_requires=["requests>=2.20.1,<3"],
19+
install_requires=["requests>=2.26.0", "urllib3>=1.26.0"],
2020
)

sypht/client.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@ def __init__(
7474
def _create_session(self):
7575
return requests.Session()
7676

77-
@staticmethod
78-
def _authenticate_v2(endpoint, client_id, client_secret, audience):
77+
def _authenticate_v2(self, endpoint, client_id, client_secret, audience):
7978
basic_auth_slug = b64encode((client_id + ":" + client_secret).encode("utf-8")).decode(
8079
"utf-8"
8180
)
82-
result = requests.post(
81+
result = self.requests.post(
8382
endpoint,
8483
headers={
8584
"Accept": "application/json",
@@ -95,10 +94,9 @@ def _authenticate_v2(endpoint, client_id, client_secret, audience):
9594

9695
return result["access_token"], result["expires_in"]
9796

98-
@staticmethod
99-
def _authenticate_v1(endpoint, client_id, client_secret, audience):
97+
def _authenticate_v1(self, endpoint, client_id, client_secret, audience):
10098
endpoint = endpoint or os.environ.get("SYPHT_AUTH_ENDPOINT", SYPHT_LEGACY_AUTH_ENDPOINT)
101-
result = requests.post(
99+
result = self.requests.post(
102100
endpoint,
103101
data={
104102
"client_id": client_id,

0 commit comments

Comments
 (0)