(self)
Sleeps long enough to enforce the rate limit
Sleeps long enough to enforce the rate limit
Sleeps long enough to enforce the rate limit
def sleep(self):
        """
        Sleeps long enough to enforce the rate limit
        """
        elapsed_s = time.time() - self.last_event
        sleep_amount = max(self.period_s - elapsed_s, 0)
        time.sleep(sleep_amount)
        self.last_event = time.time()
def sleep ( self ) : elapsed_s = time . time ( ) - self . last_event sleep_amount = max ( self . period_s - elapsed_s , 0 ) time . sleep ( sleep_amount ) self . last_event = time . time ( )