当前位置: 首页>>代码示例>>Python>>正文


Python API.append方法代码示例

本文整理汇总了Python中API.append方法的典型用法代码示例。如果您正苦于以下问题:Python API.append方法的具体用法?Python API.append怎么用?Python API.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在API的用法示例。


在下文中一共展示了API.append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: import API [as 别名]
# 或者: from API import append [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()
开发者ID:BenningtonCS,项目名称:GFS,代码行数:40,代码来源:httpClient.py

示例2: API

# 需要导入模块: import API [as 别名]
# 或者: from API import append [as 别名]
from API import API

API = API()

try:
	if (sys.argv[1] == "files"):
	        API.fileList()

	elif sys.argv[1] == "create":
		filename = sys.argv[2] 
		API.create(filename)

	elif sys.argv[1] == "append":
		filename = sys.argv[2] 
		newData = sys.argv[3] 
		API.append(filename, newData, True)

	elif sys.argv[1] == "read":
		filename = sys.argv[2] 
		byteOffSet = sys.argv[3]
		bytesToRead = sys.argv[4]
		newName = sys.argv[5]
		API.read(filename, byteOffSet, bytesToRead, newName)

	elif sys.argv[1] == "delete":
		filename = sys.argv[2] 
		API.delete(filename)

	elif sys.argv[1] == "undelete":
		filename = sys.argv[2] 
		API.undelete(filename)
开发者ID:BenningtonCS,项目名称:GFS,代码行数:33,代码来源:client.py


注:本文中的API.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。