sassoftware / ci360-download-client-python

ci360 data download client program using Python
Apache License 2.0
14 stars 11 forks source link

PyJWT updated the jwt.encode return type #4

Open weflower opened 3 years ago

weflower commented 3 years ago

There's an error on line 949 of discover.py:

CI360 DISCOVER Download API (V0.9) - last updated 23 Mar 2020Traceback (most recent call last):
  File "discover.py", line 949, in <module>
    headers = {'authorization': "Bearer "+bytes.decode(token),'cache-control': "no-cache"}
TypeError: descriptor 'decode' for 'bytes' objects doesn't apply to a 'str' object

In the latest version of PyJwt module, the return type of jwt.encode has changed to a str type instead of bytes. See changelog here: https://pyjwt.readthedocs.io/en/latest/changelog.html#improve-typings.

Not sure whether you want to test the type to accommodate earlier versions of PyJwt, but the simple fix is changing the line to: headers = {'authorization': "Bearer "+ token,'cache-control': "no-cache"}