README.rst 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. PyJWT
  2. =====
  3. .. image:: https://github.com/jpadilla/pyjwt/workflows/CI/badge.svg
  4. :target: https://github.com/jpadilla/pyjwt/actions?query=workflow%3ACI
  5. .. image:: https://img.shields.io/pypi/v/pyjwt.svg
  6. :target: https://pypi.python.org/pypi/pyjwt
  7. .. image:: https://codecov.io/gh/jpadilla/pyjwt/branch/master/graph/badge.svg
  8. :target: https://codecov.io/gh/jpadilla/pyjwt
  9. .. image:: https://readthedocs.org/projects/pyjwt/badge/?version=stable
  10. :target: https://pyjwt.readthedocs.io/en/stable/
  11. A Python implementation of `RFC 7519 <https://tools.ietf.org/html/rfc7519>`_. Original implementation was written by `@progrium <https://github.com/progrium>`_.
  12. Sponsor
  13. -------
  14. +--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | |auth0-logo| | If you want to quickly add secure token-based authentication to Python projects, feel free to check Auth0's Python SDK and free plan at `auth0.com/developers <https://auth0.com/developers?utm_source=GHsponsor&utm_medium=GHsponsor&utm_campaign=pyjwt&utm_content=auth>`_. |
  16. +--------------+-----------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. .. |auth0-logo| image:: https://user-images.githubusercontent.com/83319/31722733-de95bbde-b3ea-11e7-96bf-4f4e8f915588.png
  18. Installing
  19. ----------
  20. Install with **pip**:
  21. .. code-block:: console
  22. $ pip install PyJWT
  23. Usage
  24. -----
  25. .. code-block:: pycon
  26. >>> import jwt
  27. >>> encoded = jwt.encode({"some": "payload"}, "secret", algorithm="HS256")
  28. >>> print(encoded)
  29. eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzb21lIjoicGF5bG9hZCJ9.Joh1R2dYzkRvDkqv3sygm5YyK8Gi4ShZqbhK2gxcs2U
  30. >>> jwt.decode(encoded, "secret", algorithms=["HS256"])
  31. {'some': 'payload'}
  32. Documentation
  33. -------------
  34. View the full docs online at https://pyjwt.readthedocs.io/en/stable/
  35. Tests
  36. -----
  37. You can run tests from the project root after cloning with:
  38. .. code-block:: console
  39. $ tox