Exemplo n.º 1
0
        def topic(self):
            self.conn = S3Connection()
            self.conn.create_bucket(s3_bucket)

            config = Config(RESULT_STORAGE_BUCKET=s3_bucket, RESULT_STORAGE_AWS_STORAGE_ROOT_PATH='tata')
            ctx = Context(config=config, server=get_server('ACME-SEC'))

            storage = Storage(ctx)

            return storage.normalize_path('toto')
Exemplo n.º 2
0
        def topic(self):
            self.conn = S3Connection()
            self.conn.create_bucket(s3_bucket)

            config = Config(RESULT_STORAGE_BUCKET=s3_bucket,
                            RESULT_STORAGE_AWS_STORAGE_ROOT_PATH='tata')
            ctx = Context(config=config, server=get_server('ACME-SEC'))

            storage = Storage(ctx)

            return storage.normalize_path('toto')
Exemplo n.º 3
0
        def topic(self):
            self.conn = S3Connection()
            self.conn.create_bucket(s3_bucket)

            config = Config(RESULT_STORAGE_BUCKET=s3_bucket, RESULT_STORAGE_S3_STORE_METADATA=True)
            ctx = Context(config=config, server=get_server('ACME-SEC'))
            ctx.request_handler = RequestHandler()
            ctx.request = Request
            ctx.request.url = 'my-image-meta.jpg'

            storage = Storage(ctx)
            storage.put(IMAGE_BYTES)

            file_abspath = storage.normalize_path(ctx.request.url)
            file_key = storage.storage.get_key(file_abspath)
            return file_key.content_type, file_key.metadata, file_key.read()
Exemplo n.º 4
0
        def topic(self):
            self.conn = S3Connection()
            self.conn.create_bucket(s3_bucket)

            config = Config(RESULT_STORAGE_BUCKET=s3_bucket,
                            RESULT_STORAGE_S3_STORE_METADATA=True)
            ctx = Context(config=config, server=get_server('ACME-SEC'))
            ctx.headers = {
                'Content-Type': 'image/webp',
                'Some-Other-Header': 'doge-header'
            }
            ctx.request = Request
            ctx.request.url = 'my-image-meta.jpg'

            storage = Storage(ctx)
            storage.put(IMAGE_BYTES)

            file_abspath = storage.normalize_path(ctx.request.url)
            file_key = storage.storage.get_key(file_abspath)
            return file_key.content_type, file_key.metadata, file_key.read()