本文整理匯總了Python中models.Request.get方法的典型用法代碼示例。如果您正苦於以下問題:Python Request.get方法的具體用法?Python Request.get怎麽用?Python Request.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.Request
的用法示例。
在下文中一共展示了Request.get方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get
# 需要導入模塊: from models import Request [as 別名]
# 或者: from models.Request import get [as 別名]
def get(self, id):
try:
currentRequest = Request.get(id = id)
except peewee.DoesNotExist:
abort(404, message="Request {} doesn't exist".format(args.request_id))
return currentRequest
示例2: post
# 需要導入模塊: from models import Request [as 別名]
# 或者: from models.Request import get [as 別名]
def post(self):
args = request_parser.parse_args()
try:
currentRequest = Request.get(id = args.request_id)
currentRequest.status = 1 # status: the request is canceled
currentRequest.save()
except peewee.DoesNotExist:
abort(404, message="Request {} doesn't exist".format(args.request_id))
return args.request_id, 200