Пример #1
0
 def open(self, mode='r', headers=None, query_args=None,
          override_num_retries=None):
     if mode == 'r':
         self.mode = 'r'
         self.open_read(headers=headers, query_args=query_args,
                        override_num_retries=override_num_retries)
     elif mode == 'w':
         self.mode = 'w'
         self.open_write(headers=headers,
                         override_num_retries=override_num_retries)
     else:
         raise KS3ClientError('Invalid mode: %s' % mode)
Пример #2
0
    def open_write(self, headers=None, override_num_retries=None):
        """
        Open this key for writing.
        Not yet implemented

        :type headers: dict
        :param headers: Headers to pass in the write request

        :type override_num_retries: int
        :param override_num_retries: If not None will override configured
            num_retries parameter for underlying PUT.
        """
        raise KS3ClientError('Not Implemented')
Пример #3
0
def check_lowercase_bucketname(n):
    """
    Bucket names must not contain uppercase characters. We check for
    this by appending a lowercase character and testing with islower().
    Note this also covers cases like numeric bucket names with dashes.

    >>> check_lowercase_bucketname("Aaaa")
    Traceback (most recent call last):
    ...
    BotoClientError: S3Error: Bucket names cannot contain upper-case
    characters when using either the sub-domain or virtual hosting calling
    format.

    >>> check_lowercase_bucketname("1234-5678-9123")
    True
    >>> check_lowercase_bucketname("abcdefg1234")
    True
    """
    if not (n + 'a').islower():
        raise KS3ClientError("Bucket names cannot contain upper-case " \
            "characters when using either the sub-domain or virtual " \
            "hosting calling format.")
    return True