(20260119) Chromedriver updated and driver mismatch message print created.
This commit is contained in:
+23
-67
@@ -748,7 +748,7 @@ def today_cron(
|
|||||||
# If something goes wrong:
|
# If something goes wrong:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("MUSTER ROLL FETCH FAILED!")
|
print("MUSTER ROLL FETCH FAILED!")
|
||||||
raise
|
print("EXCEPTION:", e)
|
||||||
|
|
||||||
# IN-OUT REPORT:
|
# IN-OUT REPORT:
|
||||||
try:
|
try:
|
||||||
@@ -764,7 +764,7 @@ def today_cron(
|
|||||||
# If something goes wrong:
|
# If something goes wrong:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("IN-OUT SUMMARY FETCH FAILED!")
|
print("IN-OUT SUMMARY FETCH FAILED!")
|
||||||
raise
|
print("EXCEPTION:", e)
|
||||||
|
|
||||||
# Log out from TCAOFF:
|
# Log out from TCAOFF:
|
||||||
tcaoff.logout(tcaoff_creds)
|
tcaoff.logout(tcaoff_creds)
|
||||||
@@ -821,6 +821,7 @@ def yesterday_cron(
|
|||||||
# If something goes wrong:
|
# If something goes wrong:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("IN-OUT SUMMARY FETCH FAILED!")
|
print("IN-OUT SUMMARY FETCH FAILED!")
|
||||||
|
print("EXCEPTION:", e)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
# Log out from TCAOFF:
|
# Log out from TCAOFF:
|
||||||
@@ -849,7 +850,10 @@ def set_scheduler(
|
|||||||
:return: None.
|
:return: None.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Create the scheduler:
|
||||||
scheduler = BackgroundScheduler()
|
scheduler = BackgroundScheduler()
|
||||||
|
|
||||||
|
# Populate the tasks in the scheduler:
|
||||||
for h, m in zip(
|
for h, m in zip(
|
||||||
[8, 23, 15],
|
[8, 23, 15],
|
||||||
[30, 30, 40]
|
[30, 30, 40]
|
||||||
@@ -864,21 +868,24 @@ def set_scheduler(
|
|||||||
copy.deepcopy(tcaoff_creds)
|
copy.deepcopy(tcaoff_creds)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
scheduler.start()
|
|
||||||
|
|
||||||
try:
|
# Populate the tasks in the scheduler:
|
||||||
|
for h in range(0, 23):
|
||||||
while True:
|
for m in [0]:
|
||||||
start = time.time()
|
scheduler.add_job(
|
||||||
today_cron(
|
today_cron,
|
||||||
cosec_creds = copy.deepcopy(cosec_creds),
|
"cron",
|
||||||
tcaoff_creds = copy.deepcopy(tcaoff_creds),
|
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):
|
# Run the scheduler:
|
||||||
scheduler.shutdown()
|
scheduler.start()
|
||||||
|
while True: time.sleep(10.0)
|
||||||
|
|
||||||
|
|
||||||
# *****************************************************************************************************************
|
# *****************************************************************************************************************
|
||||||
@@ -896,62 +903,11 @@ if __name__ == "__main__":
|
|||||||
print("M-ROLL CACHE:", muster_roll_cache_file)
|
print("M-ROLL CACHE:", muster_roll_cache_file)
|
||||||
print("IN-OUT CACHE:", in_out_summary_cache_file)
|
print("IN-OUT CACHE:", in_out_summary_cache_file)
|
||||||
|
|
||||||
# Read Cosec's credentials.
|
# Read required 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"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
cosec_creds = json.from_file(cosec_creds_file)
|
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)
|
tcaoff_creds = json.from_file(tcaoff_creds_file)
|
||||||
|
|
||||||
|
# Schedule the activities:
|
||||||
set_scheduler(
|
set_scheduler(
|
||||||
cosec_creds = cosec_creds,
|
cosec_creds = cosec_creds,
|
||||||
tcaoff_creds = tcaoff_creds,
|
tcaoff_creds = tcaoff_creds,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Reference in New Issue
Block a user