Esempio n. 1
0
    def __init__(self, bucket=settings.AWS_STORAGE_BUCKET_NAME,
            access_key=None, secret_key=None, acl=DEFAULT_ACL,
            calling_format=CALLING_FORMAT, encrypt=False,
            gzip=IS_GZIPPED, gzip_content_types=GZIP_CONTENT_TYPES):
        self.bucket = bucket
        self.acl = acl
        self.encrypt = encrypt
        self.gzip = gzip
        self.gzip_content_types = gzip_content_types

        if encrypt:
            try:
                import ezPyCrypto
            except ImportError:
                raise ImproperlyConfigured("Could not load ezPyCrypto.\nSee "
                    "http://www.freenet.org.nz/ezPyCrypto/ to install it.")
            self.crypto_key = ezPyCrypto.key

        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 = HEADERS
        self.entries = self.preload and self._preload_entries() or {}
Esempio n. 2
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=False)
        self.generator.set_expires_in(QUERYSTRING_EXPIRE)
        
        self.headers = getattr(settings, HEADERS, {})
Esempio n. 3
0
    def __init__(self,
                 bucket=settings.AWS_STORAGE_BUCKET_NAME,
                 access_key=None,
                 secret_key=None,
                 acl=DEFAULT_ACL,
                 calling_format=CALLING_FORMAT,
                 encrypt=False,
                 gzip=IS_GZIPPED,
                 gzip_content_types=GZIP_CONTENT_TYPES,
                 preload_metadata=PRELOAD_METADATA):
        warnings.warn(
            "The s3 backend is deprecated and will be removed in version 1.2. "
            "Use the s3boto backend instead.", PendingDeprecationWarning)
        self.bucket = bucket
        self.acl = acl
        self.encrypt = encrypt
        self.gzip = gzip
        self.gzip_content_types = gzip_content_types
        self.preload_metadata = preload_metadata

        if encrypt:
            try:
                import ezPyCrypto
            except ImportError:
                raise ImproperlyConfigured(
                    "Could not load ezPyCrypto.\nSee "
                    "http://www.freenet.org.nz/ezPyCrypto/ to install it.")
            self.crypto_key = ezPyCrypto.key

        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 = HEADERS
        self._entries = {}
Esempio n. 4
0
 def _get_connection(self):
     return AWSAuthConnection(*self._get_access_keys())