示例#1
0
    def _execute(self):
        print 'PutObject'
        authenticate(self.parameters)
        try:
            new_file = open(os.path.join(self.path, ), 'wb')

            m = hashlib.md5()
            while True:
                chunk = self.parameters['input'].read(128)

                if not chunk:
                    break

                m.update(chunk)
                new_file.write(chunk)

            new_file.close()
            response = {
                'headers': [('ETag', '"' + m.hexdigest() + '"')],
                'body': ''
            }

            return response
        except Exception, error:
            print error
示例#2
0
文件: s3bucket.py 项目: cc1-cloud/cc1
    def _execute(self):
        print 'ListBucket'
        authenticate(self.parameters)
        bucket = self.bucket_name
        print self.path
        if not os.path.exists(self.path):  # TODO przenieść to do innych funkcji
            os.mkdir(self.path)

        return {'body': {'bucket': bucket}}
示例#3
0
    def _execute(self):
        print 'ListBucket'
        authenticate(self.parameters)
        bucket = self.bucket_name
        print self.path
        if not os.path.exists(
                self.path):  # TODO przenieść to do innych funkcji
            os.mkdir(self.path)

        return {'body': {'bucket': bucket}}
示例#4
0
文件: s3object.py 项目: cc1-cloud/cc1
    def _execute(self):
        print 'PutObject'
        authenticate(self.parameters)
        try:
            new_file = open(os.path.join(self.path, ), 'wb')

            m = hashlib.md5()
            while True:
                chunk = self.parameters['input'].read(128)

                if not chunk:
                    break

                m.update(chunk)
                new_file.write(chunk)

            new_file.close()
            response = {'headers': [('ETag', '"' + m.hexdigest() + '"')], 'body': ''}

            return response
        except Exception, error:
            print error