diff --git a/common/api/__init__.py b/common/api/__init__.py index b030c333..365e4f5e 100644 --- a/common/api/__init__.py +++ b/common/api/__init__.py @@ -27,7 +27,11 @@ class Api(): 'iat': now, 'exp': now + timedelta(hours=1) } - return jwt.encode(payload, self.private_key, algorithm='RS256').decode('utf8') + token = jwt.encode(payload, self.private_key, algorithm='RS256') + if isinstance(token, bytes): + token = token.decode('utf8') + return token + def api_get(endpoint, method='GET', timeout=None, access_token=None, **params): backend = "https://api.commadotai.com/"