From e155fa938376ea80c5b535050d2d42c72939e813 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Mon, 1 Feb 2021 10:45:04 -0800 Subject: [PATCH] Update pyjwt version to >=2.0.0,<3.0.0 Pyjwt recently made a 2.0 release. This release is not compatible with the 1.x series code. We fix the registry to be compat with pyjwt 2.x and then exclude 1.x. More details here: https://pyjwt.readthedocs.io/en/stable/changelog.html#jwt-encode-return-type Change-Id: I5c8e6fa0bb593efc70d57413b6d3274883a5a9b5 --- requirements.txt | 2 +- zuul_registry/main.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4a6967e..37e8500 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,4 @@ requests openstacksdk python-dateutil rehash -pyjwt +pyjwt>=2.0.0,<3.0.0 diff --git a/zuul_registry/main.py b/zuul_registry/main.py index 9d29704..9f97fb2 100644 --- a/zuul_registry/main.py +++ b/zuul_registry/main.py @@ -128,8 +128,7 @@ class Authorization(cherrypy.Tool): else: self.unauthorized() self.log.debug('Generate %s token', level) - token = jwt.encode({'level': level}, 'secret', - algorithm='HS256').decode('utf8') + token = jwt.encode({'level': level}, 'secret', algorithm='HS256') return {'token': token, 'access_token': token}