apollo.py
def work_day_query(self):
        """Look up today's date on the schedule to see if it is a work day. Requires login."""
        if self.logged_in:
            self.browser.get(URL_SCHEDULE)
            delay = 30  # seconds
            try:
                _ = WebDriverWait(self.browser, delay).until(
                    EC.presence_of_element_located(
                        (By.CLASS_NAME, "schedule-info__time")
                    )
                )
            except TimeoutException:
                return "Error: Loading took too much time!"
            today = datetime.datetime.today()
            day_of_week = (today.weekday() + 1) % 7
            first_day = today.replace(day=1)
            dom = today.day
            adjusted_dom = dom + ((first_day.weekday() + 1) % 7)
            week_of_month = int(ceil(adjusted_dom / 7.0))
            els_table = self.browser.find_elements_by_tag_name("table")
            els_tr = els_table[0].find_elements_by_tag_name("tr")
            els_td = els_tr[week_of_month].find_elements_by_tag_name("td")
            date_square = els_td[day_of_week]
            leave_pic = len(date_square.find_elements_by_class_name("leavePic")) > 0
            if leave_pic:
                return "leave"
            if "0800-1700" in date_square.text.split("\n"):
                return "work"
            return "off"
        else:
            return "error"
Look up today's date on the schedule to see if it is a work day. Requires login.
Look up today's date on the schedule to see if it is a work day. Requires login.
Look up today ' s date on the schedule to see if it is a work day . Requires login .
def work_day_query(self):
        if self.logged_in:
            self.browser.get(URL_SCHEDULE)
            delay = 30  
            try:
                _ = WebDriverWait(self.browser, delay).until(
                    EC.presence_of_element_located(
                        (By.CLASS_NAME, "schedule-info__time")
                    )
                )
            except TimeoutException:
                return "Error: Loading took too much time!"
            today = datetime.datetime.today()
            day_of_week = (today.weekday() + 1) % 7
            first_day = today.replace(day=1)
            dom = today.day
            adjusted_dom = dom + ((first_day.weekday() + 1) % 7)
            week_of_month = int(ceil(adjusted_dom / 7.0))
            els_table = self.browser.find_elements_by_tag_name("table")
            els_tr = els_table[0].find_elements_by_tag_name("tr")
            els_td = els_tr[week_of_month].find_elements_by_tag_name("td")
            date_square = els_td[day_of_week]
            leave_pic = len(date_square.find_elements_by_class_name("leavePic")) > 0
            if leave_pic:
                return "leave"
            if "0800-1700" in date_square.text.split("\n"):
                return "work"
            return "off"
        else:
            return "error"
def work_day_query ( self ) : if self . logged_in : self . browser . get ( URL_SCHEDULE ) delay = 30 try : _ = WebDriverWait ( self . browser , delay ) . until ( EC . presence_of_element_located ( ( By . CLASS_NAME , "schedule-info__time" ) ) ) except TimeoutException : return "Error: Loading took too much time!" today = datetime . datetime . today ( ) day_of_week = ( today . weekday ( ) + 1 ) % 7 first_day = today . replace ( day = 1 ) dom = today . day adjusted_dom = dom + ( ( first_day . weekday ( ) + 1 ) % 7 ) week_of_month = int ( ceil ( adjusted_dom / 7.0 ) ) els_table = self . browser . find_elements_by_tag_name ( "table" ) els_tr = els_table [ 0 ] . find_elements_by_tag_name ( "tr" ) els_td = els_tr [ week_of_month ] . find_elements_by_tag_name ( "td" ) date_square = els_td [ day_of_week ] leave_pic = len ( date_square . find_elements_by_class_name ( "leavePic" ) ) > 0 if leave_pic : return "leave" if "0800-1700" in date_square . text . split ( "\n" ) : return "work" return "off" else : return "error"
Look up today's date on the schedule to see if it is a work day.
Look up today ' s date on the schedule to see if it is a work day .
"""Look up today's date on the schedule to see if it is a work day. Requires login.""" # seconds
self