本文整理汇总了Python中API.stream方法的典型用法代码示例。如果您正苦于以下问题:Python API.stream方法的具体用法?Python API.stream怎么用?Python API.stream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类API
的用法示例。
在下文中一共展示了API.stream方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import API [as 别名]
# 或者: from API import stream [as 别名]
def run(self):
self.lock.acquire()
self.data = fL.recv(self.connection)
dataSplit = self.data.split('|')
print self.data
msg = dataSplit[0]
if(msg == "CREATE"):
create = API.create(dataSplit[1])
if(create == 1):
self.connection.send("CREATE|1")
elif(msg == "APPEND"):
print "append"
append = API.append(dataSplit[1], dataSplit[2], True)
if(append):
self.connection.send("1")
print "1 sent for append"
elif(msg == "READ"):
read = API.read(dataSplit[1], 0, -1, "/var/www/fileshare/download/"+dataSplit[1])
if(read):
self.connection.send("1")
elif(msg == "STREAM"):
stream = API.stream(dataSplit[1], 0, -1, "/var/www/fileshare/download/"+dataSplit[1])
if(stream):
self.connection.send("1")
elif(msg == "FILELIST"):
filelist = API.fileList()
filelist = filelist[1:-1]
split = filelist.split(', ')
string = ""
for i in split:
string += str(i[1:-1]) + "|"
if(filelist):
self.connection.send(string)
#elif(msg == "DELETE"):
self.connection.close()
self.lock.release()