在我的flask API中,我想在一个请求中将多个JSON记录一起批处理,然后将其发布到其他API。我在考虑以下伪代码。有没有办法保持烧瓶中的状态,正确的方法是什么?
@app.route(URL, methods=['GET', 'POST'])
def handle():
while True:
if request.is_json:
req_data = request.get_json()
batch.append(req_data)
if len(batch) > WINDOW:
response = api.post_data(log_type, batch)
return "{}".format(response.status_code)