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