Пример #1
0
 def get_acl(self, key_name='', headers=None):
     response = self.connection.make_request('GET', self.name, key_name,
             query_args='acl', headers=headers)
     body = response.read()
     if response.status == 200:
         policy = Policy(self)
         h = handler.XmlHandler(policy, self)
         xml.sax.parseString(body, h)
         return policy
     else:
         raise S3ResponseError(response.status, response.reason, body)
Пример #2
0
 def make_bucket(name='test_bucket', policy=None, owner_id=None):
     s3_conn = boto.connect_s3()
     policy = policy or Policy()
     owner_id = owner_id or 'test_owner_id'
     policy.owner = User(id=owner_id)
     acl = ACL()
     acl.grants = []
     policy.acl = acl
     bucket = s3_conn.create_bucket(name)
     bucket.policy = policy
     return bucket, policy
Пример #3
0
 def get_acl(self, key_name='', headers=None, version_id=None):
     query_args = 'acl'
     if version_id:
         query_args += '&versionId=%s' % version_id
     response = self.connection.make_request('GET', self.name, key_name,
                                             query_args=query_args,
                                             headers=headers)
     body = response.read()
     if response.status == 200:
         policy = Policy(self)
         h = handler.XmlHandler(policy, self)
         xml.sax.parseString(body, h)
         return policy
     else:
         raise self.connection.provider.storage_response_error(
             response.status, response.reason, body)
Пример #4
0
    async def get_acl(self,
                      key_name='',
                      headers=None,
                      version_id=None,
                      attempts=3):
        query_args = 'acl'
        if version_id:
            query_args += '&versionId=%s' % version_id

        resp = await self.connection.generate_request(
            'GET',
            self.name,
            key_name,
            query_args=query_args,
            headers=headers,
            attempts=attempts,
        )

        policy = Policy(self)
        h = XmlHandler(policy, self)
        xml.sax.parseString(resp.body, h)
        return policy