Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PyJWT to 2.3.0 #138

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docusign_esign/client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"}),
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.3.0
cryptography>=2.5
nose>=1.3.7
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.0"
Expand All @@ -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"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will require users to be on exactly version 2.3.0. I think a better option here is to specify between 2-3.

Suggested change
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"]
REQUIRES = ["urllib3 >= 1.15", "six >= 1.8.0", "certifi >= 14.05.14", "python-dateutil >= 2.5.3", "setuptools >= 21.0.0", "PyJWT>2,<3", "cryptography>=2.5", "nose>=1.3.7"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, the change on the return type of jwt.encode was introduced in 2.0.0 and it's the only thing that could be considered a breaking change in the scope of this project so I guess it'd be alright to loosen the requirement a little bit.


class CleanCommand(Command):
"""Custom clean command to tidy up the project root."""
Expand All @@ -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,
Expand Down