admin管理员组文章数量:1318768
I want to delete a cookie (for instance "cookie1") in the endpoint "/delete_cookie1"
import fasthtml as fh
@app.get("/delete_cookie1")
def delete_cookie1(request):
my_delete_cookie_function(request,'cookie1') # ?????????
Any help? Thanks
I want to delete a cookie (for instance "cookie1") in the endpoint "/delete_cookie1"
import fasthtml as fh
@app.get("/delete_cookie1")
def delete_cookie1(request):
my_delete_cookie_function(request,'cookie1') # ?????????
Any help? Thanks
Share Improve this question asked Jan 21 at 10:39 Ximo DanteXimo Dante 12511 bronze badges 1 |1 Answer
Reset to default 0Thanks to the comment from @mr-mcwolf , setting the parameter max_age=0, the cookie "cookie1" can be removed as follows:
from fasthtml import common as fh
app = fh.FastHTML
@app.get("/removecookie1")
def getdbpools(req):
return fh.cookie(key='cookie1', value='', max_age=0)
本文标签: python 3xHow to delete a cookie in FastHTMLStack Overflow
版权声明:本文标题:python 3.x - How to delete a cookie in FastHTML? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742049178a2417971.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
max-age
to 0 – mr mcwolf Commented Jan 21 at 10:47