首页 > 其他 > 详细

flask request

时间:2015-05-01 19:49:15      阅读:319      评论:0      收藏:0      [点我收藏+]

请求对象
要操作 URL (如 ?key=value )中提交的参数可以使用 args 属性:
searchword = request.args.get(‘key‘, ‘‘)
用户可能会改变 URL 导致出现一个 400 请求出错页面,这样降低了用户友好度。因此, 我们推荐使用 get 或通过捕捉 KeyError 来访问 URL 参数。

request.method == ‘POST‘
request.path == ‘/hello‘

文件上传
request.files[‘the_file‘]

Cookies
request.cookies.get(‘username‘)
resp.set_cookie(‘username‘, ‘the username‘)

flask request

原文:http://www.cnblogs.com/carlo/p/4471006.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!