1pip install pyjwt
2
3>>> import jwt
4>>> encoded_jwt = jwt.encode({"some": "payload"}, "secret", algorithm="HS256")
5>>> print(encoded_jwt)
6eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzb21lIjoicGF5bG9hZCJ9.Joh1R2dYzkRvDkqv3sygm5YyK8Gi4ShZqbhK2gxcs2U
7>>> jwt.decode(encoded_jwt, "secret", algorithms=["HS256"])
8{'some': 'payload'}