WebexPythonSDK
WebexPythonSDK copied to clipboard
GuestIssuer jwt_token.decode('utf-8') redundant?
guest_issuer.create() fails with
site-packages/webexteamssdk/api/guest_issuer.py", line 124, in create
"Authorization": "Bearer " + jwt_token.decode("utf-8")
AttributeError: 'str' object has no attribute 'decode'
I believe this happens because jwt.encode() returns plain ASCII string which doesn't provide decode() method. My environment is Python3.9. "Authorization": "Bearer " + jwt_token
works fine.
@JardaMartan could you specify the version of the dependencies (especially the jwt library) that you have installed? There used to be the reverse issue where a binary was returned and thus decode was necessary.
I'm using PyJWT 2.1.0 imported by the installation of webexteamssdk package. No other installs. Python 3.9.
(venv) JMARTAN-M-N0F8:guest jmartan$ pip install webexteamssdk
Collecting webexteamssdk
Downloading webexteamssdk-1.6-py3-none-any.whl (113 kB)
|████████████████████████████████| 113 kB 3.4 MB/s
Collecting PyJWT
Downloading PyJWT-2.1.0-py3-none-any.whl (16 kB)
----
(venv) JMARTAN-M-N0F8:guest jmartan$ pip freeze | grep -i jwt
PyJWT==2.1.0
thanks. I'll try and reproduce your error.
Ran into the same error using PyJWT. Apparently, it already provides the jwt token as a string, not a binary. The quick fix was to roll back to PyJWT==1.7.1. I suppose something could be done to check version of the dependencies of this package.