(20260119) Chromedriver updated and driver mismatch message print created.

This commit is contained in:
2026-01-19 15:34:56 +05:30
parent 0c4a610af5
commit 47ea89fd2b
3 changed files with 12398 additions and 12071 deletions
+23 -67
View File
@@ -748,7 +748,7 @@ def today_cron(
# If something goes wrong:
except Exception as e:
print("MUSTER ROLL FETCH FAILED!")
raise
print("EXCEPTION:", e)
# IN-OUT REPORT:
try:
@@ -764,7 +764,7 @@ def today_cron(
# If something goes wrong:
except Exception as e:
print("IN-OUT SUMMARY FETCH FAILED!")
raise
print("EXCEPTION:", e)
# Log out from TCAOFF:
tcaoff.logout(tcaoff_creds)
@@ -821,6 +821,7 @@ def yesterday_cron(
# If something goes wrong:
except Exception as e:
print("IN-OUT SUMMARY FETCH FAILED!")
print("EXCEPTION:", e)
raise
# Log out from TCAOFF:
@@ -849,7 +850,10 @@ def set_scheduler(
:return: None.
"""
# Create the scheduler:
scheduler = BackgroundScheduler()
# Populate the tasks in the scheduler:
for h, m in zip(
[8, 23, 15],
[30, 30, 40]
@@ -864,21 +868,24 @@ def set_scheduler(
copy.deepcopy(tcaoff_creds)
]
)
scheduler.start()
try:
while True:
start = time.time()
today_cron(
cosec_creds = copy.deepcopy(cosec_creds),
tcaoff_creds = copy.deepcopy(tcaoff_creds),
# Populate the tasks in the scheduler:
for h in range(0, 23):
for m in [0]:
scheduler.add_job(
today_cron,
"cron",
hour = h,
minute = m,
args = [
copy.deepcopy(cosec_creds),
copy.deepcopy(tcaoff_creds)
]
)
elapsed = time.time() - start
time.sleep(max(0, int(3600 - elapsed)))
except (KeyboardInterrupt, SystemExit):
scheduler.shutdown()
# Run the scheduler:
scheduler.start()
while True: time.sleep(10.0)
# *****************************************************************************************************************
@@ -896,62 +903,11 @@ if __name__ == "__main__":
print("M-ROLL CACHE:", muster_roll_cache_file)
print("IN-OUT CACHE:", in_out_summary_cache_file)
# Read Cosec's credentials.
# It should be in the format:
"""
{
"creds": {
"url": "http://x.x.x.x/COSEC/",
"username": "<usr>",
"password": "<pwd>"
},
"generalConfig": {
"pollInterval": 3600,
"timezone": "Asia/Kolkata",
"timedelta": {
"days": 0,
"hours": 24,
"minutes": 0,
"seconds": 0
}
},
"musterRollConfig": {
"groupIds": ["2", "3", "4"]
},
"inOutConfig": {
"groupIds": ["2", "3", "4"]
}
}
"""
# Read required credentials:
cosec_creds = json.from_file(cosec_creds_file)
# Read TCAOFF's credentials.
# It should be in the format:
"""
{
"creds": {
"username": "<usr>",
"password": "<pwd>",
"sessionToken": null,
"user": null
},
"urls": {
"login": "https://api.thecaoffice.com/ca/login",
"logout": "https://api.thecaoffice.com/user/logout",
"branchList": "https://api.thecaoffice.com/commons/branch/list",
"branchAdd": "https://api.thecaoffice.com/commons/branch/add",
"deptList": "https://api.thecaoffice.com/commons/departments/list",
"deptAdd": "https://api.thecaoffice.com/commons/departments/add",
"teamList": "https://api.thecaoffice.com/team/list",
"teamAdd": "https://api.thecaoffice.com/team/add",
"teamUpdate": "https://api.thecaoffice.com/team/update",
"attendanceList": "https://api.thecaoffice.com/user/attendance/register",
"attendanceMark": "https://api.thecaoffice.com/user/attendance/mark"
}
}
"""
tcaoff_creds = json.from_file(tcaoff_creds_file)
# Schedule the activities:
set_scheduler(
cosec_creds = cosec_creds,
tcaoff_creds = tcaoff_creds,