def preview_request(self, region, endpoint_name, method_name, url, query_params):
        """
        called before a request is processed.

        :param string region: the region of this request
        :param string endpoint_name: the name of the endpoint being requested
        :param string method_name: the name of the method being requested
        :param url: the URL that is being requested.
        :param query_params: dict: the parameters to the url that is being queried,
                                   e.g. ?key1=val&key2=val2
        """
        wait_until = max(
            [
                (
                    limiter.wait_until(region, endpoint_name, method_name),
                    limiter.friendly_name,
                )
                for limiter in self._limiters
            ],
            key=lambda lim_pair: lim_pair[0]
            if lim_pair[0]
            else datetime.datetime(datetime.MINYEAR, 1, 1),
        )

        if wait_until[0] is not None and wait_until[0] > datetime.datetime.now():
            to_wait = wait_until[0] - datetime.datetime.now()

            logging.info(
                "waiting for %s seconds due to %s limit...",
                to_wait.total_seconds(),
                wait_until[1],
            )
            time.sleep(to_wait.total_seconds())
def preview_request ( self , region , endpoint_name , method_name , url , query_params ) : wait_until = max ( [ ( limiter . wait_until ( region , endpoint_name , method_name ) , limiter . friendly_name , ) for limiter in self . _limiters ] , key = lambda lim_pair : lim_pair [ 0 ] if lim_pair [ 0 ] else datetime . datetime ( datetime . MINYEAR , 1 , 1 ) , ) if wait_until [ 0 ] is not None and wait_until [ 0 ] > datetime . datetime . now ( ) : to_wait = wait_until [ 0 ] - datetime . datetime . now ( ) logging . info ( "waiting for %s seconds due to %s limit..." , to_wait . total_seconds ( ) , wait_until [ 1 ] , ) time . sleep ( to_wait . total_seconds ( ) )
called before a request is processed.

        :param string region: the region of this request
        :param string endpoint_name: the name of the endpoint being requested
        :param string method_name: the name of the method being requested
        :param url: the URL that is being requested.
        :param query_params: dict: the parameters to the url that is being queried,
                                   e.g. ?key1=val&key2=val2