From a6ec3bb07ad45e1b3775169abc1407d7218ebf6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Debord?= Date: Wed, 19 Jan 2022 11:26:31 +0100 Subject: [PATCH 1/4] update requirements --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 15341f10..48f44db7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,6 @@ six >= 1.8.0 python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.15 -PyJWT>=1.7.1,<2 +PyJWT>=2 cryptography>=2.5 nose>=1.3.7 From 024960360eff157b1d3146110f56da86bd286a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Debord?= Date: Wed, 19 Jan 2022 11:34:13 +0100 Subject: [PATCH 2/4] specify PyJWT version --- requirements.txt | 2 +- setup.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 48f44db7..b055e9af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,6 @@ six >= 1.8.0 python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.15 -PyJWT>=2 +PyJWT==2.3.0 cryptography>=2.5 nose>=1.3.7 diff --git a/setup.py b/setup.py index dd6138a9..718caece 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ """ -from setuptools import setup, find_packages, Command, os # noqa: H301 +from setuptools import setup, find_packages, Command, os # noqa: H301 NAME = "docusign-esign" VERSION = "3.14.0rc1" @@ -22,7 +22,7 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools -REQUIRES = ["urllib3 >= 1.15", "six >= 1.8.0", "certifi >= 14.05.14", "python-dateutil >= 2.5.3", "setuptools >= 21.0.0", "PyJWT>=1.7.1,<2", "cryptography>=2.5", "nose>=1.3.7"] +REQUIRES = ["urllib3 >= 1.15", "six >= 1.8.0", "certifi >= 14.05.14", "python-dateutil >= 2.5.3", "setuptools >= 21.0.0", "PyJWT==2.3.0", "cryptography>=2.5", "nose>=1.3.7"] class CleanCommand(Command): """Custom clean command to tidy up the project root.""" @@ -37,7 +37,7 @@ def run(self): this_directory = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() - + setup( name=NAME, From 82b83695bc04246cdce9b15aeed48cf5604c1463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Debord?= Date: Fri, 21 Jan 2022 09:51:22 +0100 Subject: [PATCH 3/4] remove decode() --- docusign_esign/client/api_client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docusign_esign/client/api_client.py b/docusign_esign/client/api_client.py index ae786b14..2340d049 100644 --- a/docusign_esign/client/api_client.py +++ b/docusign_esign/client/api_client.py @@ -115,8 +115,8 @@ def __call_api(self, resource_path, method, _request_timeout=None): """ :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without - reading/decoding response data. Default is True. - :return: + reading/decoding response data. Default is True. + :return: """ # header parameters @@ -686,7 +686,7 @@ def request_jwt_user_token(self, client_id, user_id, oauth_host_name, private_ke later = now + (expires_in * 1) claim = {"iss": client_id, "sub": user_id, "aud": oauth_host_name, "iat": now, "exp": later, "scope": " ".join(scopes)} - token = jwt.encode(payload=claim, key=private_key_bytes, algorithm='RS256').decode("utf-8") + token = jwt.encode(payload=claim, key=private_key_bytes, algorithm='RS256') response = self.request("POST", "https://" + oauth_host_name + "/oauth/token", headers=self.sanitize_for_serialization( {"Content-Type": "application/x-www-form-urlencoded"}), @@ -818,8 +818,8 @@ def set_oauth_host_name(self, oauth_host_name=None): def set_access_token(self, token_obj): """ - :param token_obj: - :return: + :param token_obj: + :return: """ self.default_headers['Authorization'] = token_obj.access_token From 7f43d31da2bbff72c31097045ccd26c3b86a6c45 Mon Sep 17 00:00:00 2001 From: Nick Schenkels Date: Sat, 30 Jul 2022 14:57:10 +0200 Subject: [PATCH 4/4] Use environment HTTPS_PROXY or HTTP_PROXY as proxy if set --- docusign_esign/client/api_response.py | 29 +++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/docusign_esign/client/api_response.py b/docusign_esign/client/api_response.py index 0fc81fd8..40dfed35 100644 --- a/docusign_esign/client/api_response.py +++ b/docusign_esign/client/api_response.py @@ -16,6 +16,7 @@ import re import json import logging +import os from six import PY3 from six.moves.urllib.parse import urlencode @@ -81,14 +82,26 @@ def __init__(self, pools_size=4, maxsize=4): key_file = Configuration().key_file # https pool manager - self.pool_manager = urllib3.PoolManager( - num_pools=pools_size, - maxsize=maxsize, - cert_reqs=cert_reqs, - ca_certs=ca_certs, - cert_file=cert_file, - key_file=key_file - ) + proxy_url = os.environ.get("HTTPS_PROXY", os.environ.get("HTTP_PROXY")) + if proxy_url is None: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=cert_file, + key_file=key_file + ) + else: + self.pool_manager = urllib3.ProxyManager( + proxy_url=proxy_url, + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=ca_certs, + cert_file=cert_file, + key_file=key_file + ) def request(self, method, url, query_params=None, headers=None, body=None, post_params=None, _preload_content=True, _request_timeout=None):