Пример #1
0
    async def _parse_response(self, operation_name: str, http_response: aiohttp.ClientResponse):
        parser = self._parsers.get(operation_name, None)
        if parser is None:
            operation_model = self._aio_boto_client.meta.service_model.operation_model(operation_name)
            response_parser_factory = self._aio_boto_session.get_component('response_parser_factory')
            parser = operation_model, response_parser_factory.create_parser(operation_model.metadata['protocol'])
            self._parsers[operation_name] = parser

        operation_model, parser = parser

        response_dict = await convert_to_response_dict(http_response, operation_model)
        parsed_response = parser.parse(response_dict, operation_model.output_shape)
        if operation_name == "GetBucketLocation":
            parse_get_bucket_location(parsed_response, http_response)

        if http_response.status >= 300:
            raise botocore.exceptions.ClientError(parsed_response, operation_name)

        return parsed_response
Пример #2
0
 def test_get_bucket_location_optional(self):
     # This handler should no-op if another hook (i.e. stubber) has already
     # filled in response
     response = {"LocationConstraint": "eu-west-1"}
     handlers.parse_get_bucket_location(response, None),
     self.assertEqual(response["LocationConstraint"], "eu-west-1")
Пример #3
0
 def test_get_bucket_location_optional(self):
     # This handler should no-op if another hook (i.e. stubber) has already
     # filled in response
     response = {"LocationConstraint": "eu-west-1"}
     handlers.parse_get_bucket_location(response, None),
     self.assertEqual(response["LocationConstraint"], "eu-west-1")