README.rst 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. itsdangerous
  2. ============
  3. ... so better sign this
  4. Various helpers to pass data to untrusted environments and to get it
  5. back safe and sound. Data is cryptographically signed to ensure that a
  6. token has not been tampered with.
  7. It's possible to customize how data is serialized. Data is compressed as
  8. needed. A timestamp can be added and verified automatically while
  9. loading a token.
  10. Installing
  11. ----------
  12. Install and update using `pip`_:
  13. .. code-block:: text
  14. pip install -U itsdangerous
  15. .. _pip: https://pip.pypa.io/en/stable/quickstart/
  16. A Simple Example
  17. ----------------
  18. Here's how you could generate a token for transmitting a user's id and
  19. name between web requests.
  20. .. code-block:: python
  21. from itsdangerous import URLSafeSerializer
  22. auth_s = URLSafeSerializer("secret key", "auth")
  23. token = auth_s.dumps({"id": 5, "name": "itsdangerous"})
  24. print(token)
  25. # eyJpZCI6NSwibmFtZSI6Iml0c2Rhbmdlcm91cyJ9.6YP6T0BaO67XP--9UzTrmurXSmg
  26. data = auth_s.loads(token)
  27. print(data["name"])
  28. # itsdangerous
  29. Donate
  30. ------
  31. The Pallets organization develops and supports itsdangerous and other
  32. popular packages. In order to grow the community of contributors and
  33. users, and allow the maintainers to devote more time to the projects,
  34. `please donate today`_.
  35. .. _please donate today: https://palletsprojects.com/donate
  36. Links
  37. -----
  38. * Website: https://palletsprojects.com/p/itsdangerous/
  39. * Documentation: https://itsdangerous.palletsprojects.com/
  40. * License: `BSD <https://github.com/pallets/itsdangerous/blob/master/LICENSE.rst>`_
  41. * Releases: https://pypi.org/project/itsdangerous/
  42. * Code: https://github.com/pallets/itsdangerous
  43. * Issue tracker: https://github.com/pallets/itsdangerous/issues
  44. * Test status: https://travis-ci.org/pallets/itsdangerous
  45. * Test coverage: https://codecov.io/gh/pallets/itsdangerous