本文整理汇总了Python中webargs.core.get_value函数的典型用法代码示例。如果您正苦于以下问题:Python get_value函数的具体用法?Python get_value怎么用?Python get_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_value函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: parse_form
def parse_form(self, req, name, field):
"""Pull a form value from the request."""
post_data = self._cache.get('post')
if post_data is None:
yield from req.post()
self._cache['post'] = req.POST
return core.get_value(self._cache['post'], name, field)
开发者ID:gh0std4ncer,项目名称:nzbhydra,代码行数:7,代码来源:aiohttpparser.py
示例2: parse_json
def parse_json(self, req, name, arg):
"""Pull a json value from the request."""
try:
json_data = webapp2_extras.json.decode(req.body)
return core.get_value(json_data, name, arg.multiple)
except ValueError:
return core.Missing
开发者ID:Cirreth,项目名称:orglib,代码行数:7,代码来源:webapp2parser.py
示例3: parse_form
def parse_form(self, req, name, field):
"""Pull a form value from the request."""
try:
return core.get_value(req.form, name, field)
except AttributeError:
pass
return core.missing
开发者ID:NSConfArg,项目名称:NSOperations,代码行数:7,代码来源:flaskparser.py
示例4: parse_json
def parse_json(self, req, name, arg):
"""Pull a json value from the request."""
try:
return core.get_value(req.json, name, arg.multiple)
except (AttributeError, ValueError):
pass
return core.Missing
开发者ID:Ch00k,项目名称:webargs,代码行数:7,代码来源:bottleparser.py
示例5: parse_form
def parse_form(self, req, name, arg):
"""Pull a form value from the request."""
try:
return core.get_value(req.form, name, arg.multiple)
except AttributeError:
pass
return core.Missing
开发者ID:Ch00k,项目名称:webargs,代码行数:7,代码来源:flaskparser.py
示例6: parse_json
def parse_json(self, req, name, arg):
"""Pull a json value from the request body."""
try:
reqdata = json.loads(req.body.decode('utf-8'))
return core.get_value(reqdata, name, arg.multiple)
except (AttributeError, ValueError):
return None
开发者ID:tangdi,项目名称:webargs,代码行数:7,代码来源:djangoparser.py
示例7: parse_json
def parse_json(self, req, name, arg):
"""Pull a json value from the request."""
# Fail silently so that the webargs parser can handle the error
json_data = req.get_json(silent=True)
if json_data:
return core.get_value(json_data, name, arg.multiple)
else:
return core.Missing
开发者ID:Ch00k,项目名称:webargs,代码行数:8,代码来源:flaskparser.py
示例8: parse_json
def parse_json(self, req, name, arg):
"""Pull a json value from the request."""
try:
json_data = req.json_body
except ValueError:
return core.Missing
return core.get_value(json_data, name, arg.multiple)
开发者ID:venuatu,项目名称:webargs,代码行数:8,代码来源:pyramidparser.py
示例9: parse_json
def parse_json(self, req, name, field):
"""Pull a json value from the request body."""
try:
reqdata = json.loads(req.body.decode('utf-8'))
return core.get_value(reqdata, name, field)
except (AttributeError, ValueError):
pass
return core.missing
开发者ID:NSConfArg,项目名称:NSOperations,代码行数:8,代码来源:djangoparser.py
示例10: parse_json
def parse_json(self, req, name, arg):
"""Pull a json value from the request."""
if req.content_type == 'application/json' and hasattr(req, 'json'):
try:
return core.get_value(req.json, name, arg.multiple)
except AttributeError:
return None
else:
return None
开发者ID:tangdi,项目名称:webargs,代码行数:9,代码来源:flaskparser.py
示例11: parse_json
def parse_json(self, req, name, field):
"""Pull a json value from the request."""
if req.has_body:
json_data = self._cache.get('json')
if json_data is None:
self._cache['json'] = yield from req.json()
return core.get_value(self._cache['json'], name, field)
else:
return core.missing
开发者ID:gh0std4ncer,项目名称:nzbhydra,代码行数:9,代码来源:aiohttpparser.py
示例12: parse_json
def parse_json(self, req, name, field):
"""Pull a json value from the request."""
json_body = self._cache.get('json')
if json_body is None:
try:
self._cache['json'] = json_body = req.json
except (AttributeError, ValueError):
return core.missing
if json_body is not None:
return core.get_value(req.json, name, field)
else:
return core.missing
开发者ID:NSConfArg,项目名称:NSOperations,代码行数:12,代码来源:bottleparser.py
示例13: parse_json
def parse_json(self, req, name, field):
"""Pull a json value from the request."""
# Pass force in order to handle vendor media types,
# e.g. applications/vnd.json+api
# this should be unnecessary in Flask 1.0
force = is_json_request(req)
# Fail silently so that the webargs parser can handle the error
json_data = req.get_json(force=force, silent=True)
if json_data:
return core.get_value(json_data, name, field)
else:
return core.missing
开发者ID:NSConfArg,项目名称:NSOperations,代码行数:12,代码来源:flaskparser.py
示例14: parse_matchdict
def parse_matchdict(self, req, name, field):
"""Pull a value from the request's `matchdict`."""
return core.get_value(req.matchdict, name, field)
开发者ID:gh0std4ncer,项目名称:nzbhydra,代码行数:3,代码来源:pyramidparser.py
示例15: parse_cookies
def parse_cookies(self, req, name, arg):
"""Pull the value from the cookiejar."""
return core.get_value(req.cookies, name, arg.multiple)
开发者ID:venuatu,项目名称:webargs,代码行数:3,代码来源:pyramidparser.py
示例16: parse_querystring
def parse_querystring(self, req, name, arg):
"""Pull a querystring value from the request."""
return core.get_value(req.GET, name, arg.multiple)
开发者ID:venuatu,项目名称:webargs,代码行数:3,代码来源:pyramidparser.py
示例17: parse_form
def parse_form(self, req, name, arg):
"""Pull a form value from the request."""
return core.get_value(req.POST, name, arg.multiple)
开发者ID:venuatu,项目名称:webargs,代码行数:3,代码来源:pyramidparser.py
示例18: parse_data
def parse_data(request, name, field):
return core.get_value(request.data, name, field)
开发者ID:DanLindeman,项目名称:memegen,代码行数:2,代码来源:_parser.py
示例19: parse_files
def parse_files(self, req, name, arg):
"""Pull a file from the request."""
return core.get_value(req.files, name, arg.multiple)
开发者ID:Ch00k,项目名称:webargs,代码行数:3,代码来源:flaskparser.py
示例20: parse_matchdict
def parse_matchdict(self, req, name, arg):
return core.get_value(req.matchdict, name, arg.multiple)
开发者ID:Cirreth,项目名称:orglib,代码行数:2,代码来源:pyramidparser.py
注:本文中的webargs.core.get_value函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论