File: url_safe.rst

package info (click to toggle)
python-itsdangerous 2.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 412 kB
  • sloc: python: 1,055; makefile: 21; sh: 9
file content (21 lines) | stat: -rw-r--r-- 615 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
.. module:: itsdangerous.url_safe

URL Safe Serialization
======================

Often it is helpful if you can pass these trusted strings in places
where you only have a limited set of characters available. Because of
this, ItsDangerous also provides URL safe serializers:

.. code-block:: python

    from itsdangerous.url_safe import URLSafeSerializer
    s = URLSafeSerializer("secret-key")
    s.dumps([1, 2, 3, 4])
    'WzEsMiwzLDRd.wSPHqC0gR7VUqivlSukJ0IeTDgo'
    s.loads("WzEsMiwzLDRd.wSPHqC0gR7VUqivlSukJ0IeTDgo")
    [1, 2, 3, 4]

.. autoclass:: URLSafeSerializer

.. autoclass:: URLSafeTimedSerializer