0
我在我的應用程序中有一個端點,當它打到時我想向客戶端發送一個響應。我在燒瓶裏這樣做。如何在Flask中寫入文本到響應中
from flask import Response
def heartbeat():
response = Response()
response.headers['Last-Modified'] = datetime.now()
response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0'
response.headers['Expires'] = '-1'
return response(heartbeat)
這是拋出那叫一個錯誤有三個參數。我在這裏錯過了什麼?
你應該正確地格式化你的代碼!縮進不匹配。 – 2014-10-30 13:18:49
我使用make_response修復了它。謝謝 – station 2014-10-30 13:21:27