instabot/bot/bot.py
def delay(self, key):
        """Sleep only if elapsed time since `self.last[key]` < `self.delay[key]`."""
        last_action, target_delay = self.last[key], self.delays[key]
        elapsed_time = time.time() - last_action
        if elapsed_time < target_delay:
            t_remaining = target_delay - elapsed_time
            time.sleep(t_remaining * random.uniform(0.25, 1.25))
        self.last[key] = time.time()
def delay(self, key):
        """Sleep only if elapsed time since `self.last[key]` < `self.delay[key]`."""
        last_action, target_delay = self.last[key], self.delays[key]
        elapsed_time = time.time() - last_action
        if elapsed_time < target_delay:
            t_remaining = target_delay - elapsed_time
            time.sleep(t_remaining * random.uniform(0.25, 1.25))
        self.last[key] = time.time()
Sleep only if elapsed time since `self.last[key]` < `self.delay[key]`.