alibabacloud.request.HTTPRequest - python examples

Here are the examples of the python api alibabacloud.request.HTTPRequest taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

0 View Complete Implementation : client.py
Copyright Apache License 2.0
Author : aliyun
    def _handle_request(self, api_request, _raise_exception=True):
        http_request = HTTPRequest()
        context = RequestContext(api_request=api_request, http_request=http_request,
                                 config=self.config, client=self)
        handler_index = 0
        while 1:
            for handler in self.handlers[handler_index:]:
                handler.handle_request(context)

            for handler in reversed(self.handlers[handler_index:]):
                handler.handle_response(context)
                if context.retry_flag:
                    time.sleep(context.retry_backoff / float(1000))
                    handler_index = self.handlers.index(handler)
                    break
            if not context.retry_flag:
                break
        if context.exception and _raise_exception:
            raise context.exception
        # body
        context.client.logger.debug('Response received. Product:%s Response-body: %s',
                                    self.product_code, context.http_response.text)

        # TODO
        return context