本文整理汇总了Python中api_functions.CronosDB.get_award_category_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python CronosDB.get_award_category_by_id方法的具体用法?Python CronosDB.get_award_category_by_id怎么用?Python CronosDB.get_award_category_by_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api_functions.CronosDB
的用法示例。
在下文中一共展示了CronosDB.get_award_category_by_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_award_category
# 需要导入模块: from api_functions import CronosDB [as 别名]
# 或者: from api_functions.CronosDB import get_award_category_by_id [as 别名]
def update_award_category(award_id, category_id):
response.headers['Content-Type'] = 'application/json'
db = CronosDB("root", "zerl", "cronos")
try:
try:
data = json.load(request.body)
except Exception as error:
raise ValueError("Cannot parse request: {0}".format(error))
if data is None:
raise ValueError("Request is None")
if not db.update_award_category(category_id, award_id, data["name"]):
raise ValueError("Cannot update award category {0}-{1}-{2}".format(category_id, award_id, data["name"]))
return json.dumps(db.get_award_category_by_id(award_id, category_id))
except ValueError as error:
msg = "Exception...{0}".format(error)
response.status = 400
print msg
return json.dumps({"status": 400, "msg": msg})
示例2: show_award_category_by_id
# 需要导入模块: from api_functions import CronosDB [as 别名]
# 或者: from api_functions.CronosDB import get_award_category_by_id [as 别名]
def show_award_category_by_id(award_id, category_id):
db = CronosDB("root", "zerl", "cronos")
response.headers['Content-Type'] = 'application/json'
return json.dumps(db.get_award_category_by_id(award_id, category_id))