本文整理汇总了Python中data_class.Stream.insert_with_lock方法的典型用法代码示例。如果您正苦于以下问题:Python Stream.insert_with_lock方法的具体用法?Python Stream.insert_with_lock怎么用?Python Stream.insert_with_lock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_class.Stream
的用法示例。
在下文中一共展示了Stream.insert_with_lock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from data_class import Stream [as 别名]
# 或者: from data_class.Stream import insert_with_lock [as 别名]
def post(self):
pictures = self.request.get_all('files[]')
results = []
if len(pictures) > 0:
stream_id = self.request.get('stream_id')
# print "stream name is ", stream_id
for image in pictures:
Stream.insert_with_lock(stream_id, image)
results.append({'name': '', 'url': '', 'type': '', 'size': 0})
s = json.dumps({'files': results}, separators=(',', ':'))
self.response.headers['Content-Type'] = 'application/json'
# print "duming material is ", s
return self.response.write(s)
示例2: post
# 需要导入模块: from data_class import Stream [as 别名]
# 或者: from data_class.Stream import insert_with_lock [as 别名]
def post(self):
pictures = self.request.get_all('files')
results = []
print "Android_upload called"
if len(pictures) > 0:
stream_id = self.request.get('stream_id')
print "stream name is ", stream_id
str_lon = self.request.get('longitude')
str_lat = self.request.get('latitude')
print str_lon + " " + str_lat
for image in pictures:
if str_lon == "" or str_lat == "":
Stream.insert_with_lock(stream_id,image)
else:
Stream.insert_with_lock(stream_id, image,False,float(str_lat),float(str_lon))