本文整理汇总了Python中data_class.Stream.put方法的典型用法代码示例。如果您正苦于以下问题:Python Stream.put方法的具体用法?Python Stream.put怎么用?Python Stream.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_class.Stream
的用法示例。
在下文中一共展示了Stream.put方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from data_class import Stream [as 别名]
# 或者: from data_class.Stream import put [as 别名]
def post(self):
data = json.loads(self.request.body)
user = data['user_id']
print user, ' is creating'
new_stream = Stream(parent=ndb.Key('User', user),
stream_id=data['stream_id'],
user_id=data['user_id'],
tags=data['tags'],
cover_url=data['cover_url'] if 'cover_url' in data else '',
views=0,
num_images=0,
last_add=str(datetime.now()),
owner=data['owner'],
)
new_stream.put()
result = json.dumps({'status': '0'})
self.response.write(result)
示例2: post
# 需要导入模块: from data_class import Stream [as 别名]
# 或者: from data_class.Stream import put [as 别名]
def post(self):
data = json.loads(self.request.body)
user = data["user_id"]
print user, " is creating"
new_stream = Stream(
parent=ndb.Key("User", user),
stream_id=data["stream_id"],
user_id=data["user_id"],
tags=data["tags"],
cover_url=data["cover_url"] if "cover_url" in data else "",
views=0,
num_images=0,
last_add=str(datetime.now()),
owner=data["owner"],
)
new_stream.put()
result = json.dumps({"status": "0"})
self.response.write(result)