开发者

How to set Secure Cookie on WSGI applications in python

开发者 https://www.devze.com 2023-04-04 14:23 出处:网络
How to set Secure Cookie on WSGI applications in python With Secure Cookie I mea开发者_StackOverflow社区n one that can be read on only httpsThe Response.set_cookie function accepts an optional secure

How to set Secure Cookie on WSGI applications in python With Secure Cookie I mea开发者_StackOverflow社区n one that can be read on only https


The Response.set_cookie function accepts an optional secure parameter. Example:

>>> res.set_cookie('key', 'value', max_age=360, path='/',
...                domain='example.org', secure=True)
>>> res.headers['Set-Cookie']
'key=value; Domain=example.org; Max-Age=360; Path=/; expires=... GMT; secure'

You can use secure=True in case you use HTTPS.

See here for more details.

0

精彩评论

暂无评论...
验证码 换一张
取 消