Exemple #1
0
    def __init__(self,
                 bucket=settings.AWS_STORAGE_BUCKET_NAME,
                 access_key=None,
                 secret_key=None,
                 acl=DEFAULT_ACL,
                 calling_format=settings.AWS_CALLING_FORMAT):
        self.bucket = bucket
        self.acl = acl

        if not access_key and not secret_key:
            access_key, secret_key = self._get_access_keys()

        self.connection = AWSAuthConnection(access_key,
                                            secret_key,
                                            calling_format=calling_format)
        self.generator = QueryStringAuthGenerator(
            access_key,
            secret_key,
            calling_format=calling_format,
            is_secure=SECURE_URLS)
        self.generator.set_expires_in(QUERYSTRING_EXPIRE)

        self.headers = getattr(settings, HEADERS, {})