def _safe_index_json(json_, key, warning_message):
"""
Safely index the given JSON object
:param json_: JSON object
:param key: Key to inspect in JSON object
:param warning_message: Warning message to log if key is missing
:returns: None if not found or value at key
"""
try:
return json_[key]
except KeyError:
app.logger.warning('%s, json:%s', warning_message,
json.dumps(request.json))
return None
评论列表
文章目录