def get(self, id_, type_):
"""GET object with id = id_ from the database."""
if get_authentication():
if request.authorization is None:
return failed_authentication()
else:
auth = check_authorization(request, get_session())
if auth is False:
return failed_authentication()
class_type = get_doc().collections[type_]["collection"].class_.title
if checkClassOp(class_type, "GET"):
try:
response = crud.get(id_, class_type, api_name=get_api_name(), session=get_session())
return set_response_headers(jsonify(hydrafy(response)))
except Exception as e:
status_code, message = e.get_HTTP()
return set_response_headers(jsonify(message), status_code=status_code)
abort(405)
评论列表
文章目录