码迷,mamicode.com
首页 > 其他好文 > 详细

flask request

时间:2015-05-01 19:51:34      阅读:119      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!