From c8df3c4730dacd955ed2bb207fd02b099b4c007e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Jan 2021 07:48:31 +0000 Subject: [PATCH 1/2] Bump pyjwt from 1.7.1 to 2.0.0 Bumps [pyjwt](https://github.com/jpadilla/pyjwt) from 1.7.1 to 2.0.0. - [Release notes](https://github.com/jpadilla/pyjwt/releases) - [Changelog](https://github.com/jpadilla/pyjwt/blob/master/CHANGELOG.md) - [Commits](https://github.com/jpadilla/pyjwt/compare/1.7.1...2.0.0) Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 87ec29fb6..ae6ba2e46 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ sdnotify==0.3.2 # API Server fastapi==0.63.0 uvicorn==0.13.3 -pyjwt==1.7.1 +pyjwt==2.0.0 # Support for colorized terminal output colorama==0.4.4 From 8631a54514084879c9507fe7d0f89ae4464d84b5 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 8 Jan 2021 19:27:51 +0100 Subject: [PATCH 2/2] Fix test due to pyjwt2.0 --- freqtrade/rpc/api_server/api_auth.py | 2 +- tests/rpc/test_rpc_apiserver.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/freqtrade/rpc/api_server/api_auth.py b/freqtrade/rpc/api_server/api_auth.py index 110bb2a25..a39e31b85 100644 --- a/freqtrade/rpc/api_server/api_auth.py +++ b/freqtrade/rpc/api_server/api_auth.py @@ -44,7 +44,7 @@ def get_user_from_token(token, secret_key: str, token_type: str = "access"): return username -def create_token(data: dict, secret_key: str, token_type: str = "access") -> bytes: +def create_token(data: dict, secret_key: str, token_type: str = "access") -> str: to_encode = data.copy() if token_type == "access": expire = datetime.utcnow() + timedelta(minutes=15) diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index dfb0fb956..2212d4a79 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -93,7 +93,7 @@ def test_api_auth(): create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234', token_type="NotATokenType") token = create_token({'identity': {'u': 'Freqtrade'}}, 'secret1234') - assert isinstance(token, bytes) + assert isinstance(token, str) u = get_user_from_token(token, 'secret1234') assert u == 'Freqtrade'