蟒蛇+瓶 - 去除会话过快关键 [英] Python + Flask - Removing key from session too fast

查看:161
本文介绍了蟒蛇+瓶 - 去除会话过快关键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经和API服务,使这样的:

I have and API service that make this:

session[parent].pop(child)

但是,当我把这种服务超过一次,并在浏览器的同时,这似乎太快瓶(或Python,或者我不知道)。只是一个'孩子'被删除。我试图用

But, when I call this service more than one time and at the same time in Browser, this seems too fast for Flask (or Python, or I don't know). Just one 'child' is removed. I tried to use

del session[parent][child]

,但问题是一样的。我可以得到值的列表在我的API服务来解决,但是,我想知道为什么发生这种情况。

but the problem was the same. I can get a list of values in my API Service to resolve that, but, I want to understand why this is happening.

我不知道这是否是一个烧瓶问题,一个Python的问题,一个网络的东西的问题...

I don't know if it is a Flask problem, a Python problem, a 'Web Stuff' problem...

推荐答案

这是一个网页内容的问题。

It's a 'Web Stuff' problem.

什么情况是,浏览器中存储收到的最后一个版本。但是,如果它接收响应失灵,或者在完成之前你中止请求,浏览器不会存储该版本。

What happens is that the browser stores the last version it received. But if it receives responses out of order, or you abort a request before it is completed, the browser won't be storing that version.

瓶商店为会议完全在cookie中的数据。没有什么存储在比用于加密和解密内容的服务器端秘密其它服务器侧

Flask stores the data for session entirely in a cookie. There is nothing stored on the server side other than the server-side secret used to encrypt and decrypt the contents.

用该Cookie的响应被发送到浏览器,浏览器中存储的cookie。这是一个完全不透明的一块数据到浏览器,它不能做任何事,因为它是COM pressed和加密签名。

A response with that cookie is sent to the browser, and the browser stores the cookie. This is an entirely opaque piece of data to the browser, it cannot do anything with it as it is compressed and cryptographically signed.

浏览器会再发送该cookie的正如的回瓶服务器的每一个发出请求的时间。如果该请求的响应中包含的cookie的新版本,则该系统会存储在浏览器cookie存储。任何新的请求的存储的然后将使用新的cookie后启动。

The browser will then send that cookie as is back to the Flask server every time a request is made. If the response to that request contains a new version of the cookie, then that'll be stored in the browser cookie storage. Any new request started after storing will then use the new cookie.

但是,如果你开始一个请求的的响应已​​经完全处理,或者没有完成处理的响应,则较旧的cookie可以使用你的服务器去codeS,老年人版本的变化不可缺少的。

If however, you start a request before a response has been fully processed, or did not complete handling the response, then an older cookie could be used and your server decodes that older version with the changes not made.

这篇关于蟒蛇+瓶 - 去除会话过快关键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆