Doozer-S3¶
Doozer-S3 is a library that helps to easily interact with S3 from inside a Doozer application.
Installation¶
Doozer-S3 can be installed with:
$ python -m pip install Doozer-S3
Warning
Doozer-S3 is not yet available on the Python Package Index.
Configuration¶
The following configuration settings can be added to the application.
AWS_ACCESS_KEY_ID |
The Access ID used to identify the account. Defaults to None. |
AWS_SECRET_ACCESS_KEY |
The Access Secret used to identify the account. Defaults to None. |
AWS_BUCKET_NAME |
The name of the default bucket to use. Defaults to None. |
AWS_REGION_NAME |
The name of the Region where the bucket is located. Defaults to None. |
Usage¶
from doozer import Application
from doozer_s3 import S3
app = Application('application-with-s3')
app.settings['AWS_BUCKET_NAME'] = 'my-doozer-bucket'
S3(app)
API¶
-
class
doozer_s3.
S3
(app=None)[source]¶ A class to interact with S3.
-
check
(key, *, bucket=None)[source]¶ Check to see if a file exists in an S3 bucket.
Parameters: Returns: True if the file exists.
Return type: Raises: ValueError – If no bucket name is specified.
-
download
(key, *, bucket=None)[source]¶ Return the contents of a file in an S3 bucket.
Parameters: Returns: The contents of the file.
Return type: Raises: - FileNotFoundError – If the key isn’t found.
- ValueError – If no bucket name is specified.
-
init_app
(app)[source]¶ Initialize an
Application
instance.Parameters: app (doozer.base.Application) – The application instance to be initialized.
-
upload
(key, file, *, bucket=None)[source]¶ Upload a file to an S3 bucket.
Parameters: Raises: ValueError – If no bucket name is specified.
-
Contents: