Flask request浅析

2018-04-07  本文已影响0人  Alex_Dj

request的作用

你可以使用全局 request 对象访问进入的请求数据。 Flask 处理进入的请求数据并允许你用这个全局对象访问它。如果你工作在多线程环境,Flask 内部保证你总会在当前线程上获取正确的数据

request请求及参数获取

请求类型

参数获取

request.form.get("key", type=str, default=None) 获取表单数据
request.args.get("key") 获取get请求参数
request.values.get("key") 获取所有参数

flask.Request.args
A MultiDict with the parsed contents of the query string. (The part in the URL after the question mark).
So the args.get() is method get() for [MultiDict]

get(key, default=None, type=None)
上一篇下一篇

猜你喜欢

热点阅读