Flask:如何读取流输入

时间:2014-07-11 17:35:23

标签: python flask

我想使用flask从客户端读取大数据(基本上是无限的)流。在URL的处理程序方法中,我想在无限循环中读取一些数据然后产生。这会有用吗?

澄清一下,我想做点如下的事情:

    @app.route("/spectrumdb/stream",methods=["POST"])
    def datastream():
      get the input stream of the request object.
      Sit in an infinite loop, incrementally reading the input stream in chunks
       and processing each chunk yeild the
      interpreter after each chunk is processed.

提前感谢您的回复。

朗高

1 个答案:

答案 0 :(得分:0)

我认为正确的解决方案是在烧瓶服务器上使用websockets而不是使用原始HTTP帖子。谢谢大家的回复。我会更新这是怎么回事。

相关问题