README.rst 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. PyJWT
  2. =====
  3. .. image:: https://travis-ci.com/jpadilla/pyjwt.svg?branch=master
  4. :target: http://travis-ci.com/jpadilla/pyjwt?branch=master
  5. .. image:: https://ci.appveyor.com/api/projects/status/h8nt70aqtwhht39t?svg=true
  6. :target: https://ci.appveyor.com/project/jpadilla/pyjwt
  7. .. image:: https://img.shields.io/pypi/v/pyjwt.svg
  8. :target: https://pypi.python.org/pypi/pyjwt
  9. .. image:: https://coveralls.io/repos/jpadilla/pyjwt/badge.svg?branch=master
  10. :target: https://coveralls.io/r/jpadilla/pyjwt?branch=master
  11. .. image:: https://readthedocs.org/projects/pyjwt/badge/?version=latest
  12. :target: https://pyjwt.readthedocs.io
  13. A Python implementation of `RFC 7519 <https://tools.ietf.org/html/rfc7519>`_. Original implementation was written by `@progrium <https://github.com/progrium>`_.
  14. Sponsor
  15. -------
  16. +--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | |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/overview <https://auth0.com/overview?utm_source=GHsponsor&utm_medium=GHsponsor&utm_campaign=pyjwt&utm_content=auth>`_. |
  18. +--------------+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. .. |auth0-logo| image:: https://user-images.githubusercontent.com/83319/31722733-de95bbde-b3ea-11e7-96bf-4f4e8f915588.png
  20. Installing
  21. ----------
  22. Install with **pip**:
  23. .. code-block:: sh
  24. $ pip install PyJWT
  25. Usage
  26. -----
  27. .. code:: python
  28. >>> import jwt
  29. >>> encoded = jwt.encode({'some': 'payload'}, 'secret', algorithm='HS256')
  30. 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoicGF5bG9hZCJ9.4twFt5NiznN84AWoo1d7KO1T_yoc0Z6XOpOVswacPZg'
  31. >>> jwt.decode(encoded, 'secret', algorithms=['HS256'])
  32. {'some': 'payload'}
  33. Command line
  34. ------------
  35. Usage::
  36. pyjwt [options] INPUT
  37. Decoding examples::
  38. pyjwt --key=secret decode TOKEN
  39. pyjwt decode --no-verify TOKEN
  40. See more options executing ``pyjwt --help``.
  41. Documentation
  42. -------------
  43. View the full docs online at https://pyjwt.readthedocs.io/en/latest/
  44. Tests
  45. -----
  46. You can run tests from the project root after cloning with:
  47. .. code-block:: sh
  48. $ python setup.py test