def add_timeout(cls, driver: Driver, timeout: int): payload = cls.get_payload(driver) if not payload.timeout: payload.timeout_set_at = datetime.now() if payload.timeout: payload.timeout += timeout else: payload.timeout = timeout payload.save() logger.info("add timeout %i for %s %s", timeout, driver.name, driver.surname)
def register_driver(cls, driver: Driver, tg_name: str, tg_id: int) -> Driver: logger.info(f"registering driver {tg_name} with id {tg_id}") driver.add_tg_info(tg_name, tg_id) driver.save() return driver
def get_all_drivers_from_map(cls) -> List[Driver]: logger.info("fetching drivers list from map") drivers_info = SeleniumClient.get_drivers_info_from_map() return cls._drivers_info_to_drivers(drivers_info)
def _get_all_drivers_info(cls) -> Iterable[Dict]: logger.info("fetching drivers list") yield from SeleniumClient.get_all_drivers_info()
def get_all_drivers(cls) -> List[Driver]: logger.info("fetching all drivers") drivers_info = SeleniumClient.get_all_drivers_info() logger.info("all drivers fetched") return cls._drivers_info_to_drivers(drivers_info)