sqlalchemy_imageattach.stores.s3 — AWS S3 backend storage¶The backend storage implementation for Simple Storage Service provided by Amazon Web Services.
sqlalchemy_imageattach.stores.s3.BASE_URL_FORMAT = 'https://{0}.s3.amazonaws.com'¶(str) The format string of base url of AWS S3.
Contains no trailing slash.
Default is 'https://{0}.s3.amazonaws.com'.
sqlalchemy_imageattach.stores.s3.DEFAULT_MAX_AGE = 31536000¶(numbers.Integral) The default max-age seconds of
Cache-Control. It’s the default value of
S3Store.max_age attribute.
sqlalchemy_imageattach.stores.s3.S3Request(url, bucket, access_key, secret_key, data=None, headers={}, method=None, content_type=None)¶HTTP request for S3 REST API which does authentication.
sqlalchemy_imageattach.stores.s3.S3SandboxStore(underlying, overriding, access_key=None, secret_key=None, max_age=31536000, underlying_prefix='', overriding_prefix='')¶It stores images into physically two separated S3 buckets while
these look like logically exist in the same store. It takes two buckets
for read-only and overwrite: underlying and overriding.
It’s useful for development/testing purpose, because you can use the production store in sandbox.
| Parameters: |
|
|---|
DELETED_MARK_MIMETYPE = 'application/x-sqlalchemy-imageattach-sandbox-deleted'¶All keys marked as “deleted” have this mimetype as its Content-Type header.
sqlalchemy_imageattach.stores.s3.S3Store(bucket, access_key=None, secret_key=None, max_age=31536000, prefix='', public_base_url=None)¶Image storage backend implementation using S3. It implements
Store interface.
If you’d like to use it with Amazon CloudFront, pass the base url of
the distribution to public_base_url. Note that you should configure
Forward Query Strings to Yes when you create the distribution.
Because SQLAlchemy-ImageAttach will add query strings to public URLs
to invalidate cache when the image is updated.
| Parameters: |
|
|---|
Changed in version 0.8.1: Added public_base_url parameter.
bucket = None¶(basestring) The S3 bucket name.
max_age = None¶(numbers.Integral) The max-age seconds of
Cache-Control.
prefix = None¶(basestring) The optional key prefix to logically separate
stores with the same bucket.
public_base_url = None¶(basestring) The optional url base for public urls.