From 690eafc8b6d89ee9df5aa63c455f7a2bd569d5af Mon Sep 17 00:00:00 2001 From: Granth Agarwal Date: Sat, 21 Dec 2024 19:14:26 +0530 Subject: [PATCH] added itsdangerous terminal commands --- personal-references/itsdangerous-terminal-cmds.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 personal-references/itsdangerous-terminal-cmds.md diff --git a/personal-references/itsdangerous-terminal-cmds.md b/personal-references/itsdangerous-terminal-cmds.md new file mode 100644 index 0000000..2c4f45a --- /dev/null +++ b/personal-references/itsdangerous-terminal-cmds.md @@ -0,0 +1,8 @@ +# itsdangerous Terminal Commands + +- python3 +- from itsdangerous import URLSafeTimedSerializer as Serializer +- s = Serializer('secret') +- token = s.dumps({'user_id':1}) +- token = s.loads(token, 30) +> It is used to create a serializer object `s` with a `secret key` and a time limit of 30 seconds. And `token` is used to dump and load the data.