stackoverflow上的解释是:
From the source code, we learn that Flask uses client side session which is based on secure cookies.
Thus we could achieve the same thing by using Falcon Cookies API which also uses secure cookies by default.
(在源码里,flask用的是基于cookie的客户端session,falcon也可以这么玩)
https://stackoverflow.com/questions/40677508/falcon-framework-how-to-store-variables-in-a-session
#设置
class ExampleResource(object):
def on_get(self, req, resp):
resp.set_cookie('foo', 'bar')
resp.body = 'bar'
#获取
class BarResource(object):
def on_get(self, req, resp):
resp.body = req.cookies.get('foo')