def _sent_http_request_once()

in alibabacloud_oss_v2/_client.py [0:0]


    def _sent_http_request_once(self, context: SigningContext, options: _Options) -> HttpResponse:
        # sign request
        if not isinstance(options.credentials_provider, AnonymousCredentialsProvider):
            try:
                cred = options.credentials_provider.get_credentials()
            except Exception as e:
                raise exceptions.CredentialsFetchError(error=e)

            if cred is None or not cred.has_keys():
                raise exceptions.CredentialsEmptyError()

            # update credentials
            context.credentials = cred

            options.signer.sign(context)

        # send
        send_kwargs = {}
        if options.response_stream is not None:
            send_kwargs['stream'] = options.response_stream
        if options.readwrite_timeout is not None:
            send_kwargs['readwrite_timeout'] = options.readwrite_timeout

        response = options.http_client.send(context.request, **send_kwargs)

        # response handler
        for h in options.response_handlers:
            h(response)

        return response