pusher / push-notifications-python

Pusher Beams Python Server SDK
https://pusher.com/beams
MIT License
30 stars 8 forks source link

Fix: Support PyJWT 2 and up #27

Closed marcgibbons closed 3 years ago

marcgibbons commented 3 years ago

The current requirements specify a dependency of pyjwt < 2. This restriction can cause conflicts in projects using PyJWT 2.x either explicitly or as a dependency of another library.

In Python 3 with PyJWT 2.0.1, the token returned is a string type and not bytes, so the .decode('utf-8') was replaced with six.enforce_text to support both strings and bytes.

There is a typo in one of the tests – jwt.decode expects the kwarg alogrithms, not algorithm. This silently passes in PyJWT < 2, but is a requirement in later versions.

Finally, I unpinned the dev requirement versions as the specified version of pylint errors in the 3.6 environment.

🚀

codecov-io commented 3 years ago

Codecov Report

Merging #27 (0cdbedd) into master (41300ee) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #27   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          483       484    +1     
=========================================
+ Hits           483       484    +1     
Impacted Files Coverage Δ
tests/test_users.py 100.00% <ø> (ø)
pusher_push_notifications/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 41300ee...0cdbedd. Read the comment docs.

jonathanlloyd commented 3 years ago

Thanks for the contribution! I'll get this released asap :smile:

marcgibbons commented 3 years ago

@jonathanlloyd thank you!