return strFileMove def getBody(self): return json.dumps({ 'src': '/'.join([self.atName, self.path]), 'dst': '/'.join([self.atName, self.dst]) }) if __name__ == '__main__': # t = ContainerPut('she','test') # t = ContainerGet('she','test') # t = ContainerHead('she','test') # t = ContainerPost('she','test',quota=1024*1024*1024) # t = ContainerDelete('she','test') # t = FilePut('she','test/test.txt','/root/install.log') # t = MetaPut('she','test/dr/test2.txt','8dd16a3d50854caae6a23917d41688f3') t = FileGet('she', 'test/test.txt') # for data in mission.download(t): # print data # print len(data) # t = FileCopy('she','test/test.txt','test/cp.txt') # t = FileMove('she','test/test2.txt','test/mv.txt') # t = FilePost('she','test/mv.txt',action='move') # t = FileHead('she','test/mv.txt') # t = FileDelete('she','test/test.txt') t = mission.execute(t, port=80) print t.status print t.data
return '/'.join(['',self.version,self.path]) class ObjectPost(SwiftTask): def __init__(self,path,**kwargs): super(ObjectPost,self).__init__() self.path = path self.kwargs = kwargs def getMethod(self): return 'POST' def getUrl(self): return '/'.join(['',self.version,self.path]) def getHeaders(self): return self.kwargs if __name__ == '__main__': # t = ObjectGet('li/test/obj.txt') t = ObjectPut('li/test/obj1.txt','/root/install.log') # t = ObjectHead('li/test/obj.txt') # t = ObjectPost('li/test/obj.txt',oquota=100) # t = ObjectDelete('li/test/obj.txt') # import pdb;pdb.set_trace() t = mission.execute(t) print t.status print t.data print t.headers
return strAcountPost class AccountHead(Task): def __init__(self,atName): self.atName = atName def getBody(self): return json.dumps({'path':self.atName}) def getHeaders(self): return {} def getUrl(self): return strAcountHead if __name__ == "__main__": # t = AccountPut('li') t = AccountGet('she') # t = AccountHead('she') # t = AccountPost('she',quota=1024*1024*1024) t = mission.execute(t,port=80) print t.status print t.data