(20260217) Ready to test on production now

This commit is contained in:
2026-02-17 15:26:19 +05:30
parent 64a6eac20f
commit 1fe8b1e68c
4 changed files with 26 additions and 8 deletions
+5 -3
View File
@@ -570,10 +570,12 @@ class AsyncTheCAOffice:
if response.status_code not in [200]: if response.status_code not in [200]:
try: try:
response_json = response.json() response_json = response.json()
print("TCAOFF Attendance-Mark:", json.to_string(response_json)) # print("TCAOFF Attendance-Mark:", json.to_string(response_json))
self._printer("TCAOFF Attendance-Mark", response_json)
except Exception as e: except Exception as e:
print("TCAOFF Attendance-Mark:", e) # print("TCAOFF Attendance-Mark:", e)
print("TCAOFF Attendance-Mark:", response.content) # print("TCAOFF Attendance-Mark:", response.content)
self._printer("TCAOFF Attendance-Mark", e, response.content)
print("Payload:", json.to_string(json_payload)) print("Payload:", json.to_string(json_payload))
# If the call succeeded: # If the call succeeded:
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -721,7 +721,7 @@ async def sync_attendance_to_tcaoff(
yield lst[i:i + size] yield lst[i:i + size]
count = 0 count = 0
for chunk in chunks(tasks[:], size = 100): for chunk in chunks(tasks[:], size = 10):
count += 1 count += 1
printer("Task Chunk:", count) printer("Task Chunk:", count)
_res = await asyncio.gather(*chunk) _res = await asyncio.gather(*chunk)
+19 -3
View File
@@ -284,7 +284,7 @@ async def set_scheduler(
await yesterday_cron( await yesterday_cron(
cosec_creds = copy.deepcopy(cosec_creds), cosec_creds = copy.deepcopy(cosec_creds),
tcaoff_client = tcaoff_client, tcaoff_client = tcaoff_client,
# test_mode = test_mode test_mode = test_mode
) )
await today_cron( await today_cron(
cosec_creds = copy.deepcopy(cosec_creds), cosec_creds = copy.deepcopy(cosec_creds),
@@ -342,6 +342,21 @@ async def set_scheduler(
if __name__ == "__main__": if __name__ == "__main__":
# Parse args:
import argparse
ap = argparse.ArgumentParser()
ap.add_argument(
"--test",
action = "store_true",
default = False,
)
ap.add_argument(
"--verbose",
action = "store_true",
default = False,
)
args = ap.parse_args()
# Explicitly mention the expected file paths for other devs to maintain: # Explicitly mention the expected file paths for other devs to maintain:
print("PROJ. DIR. :", common.PROJ_DIR) print("PROJ. DIR. :", common.PROJ_DIR)
print("COSEC CREDS :", common.COSEC_CREDS_FILE) print("COSEC CREDS :", common.COSEC_CREDS_FILE)
@@ -355,12 +370,13 @@ if __name__ == "__main__":
tcaoff_client = AsyncTheCAOffice( tcaoff_client = AsyncTheCAOffice(
username = tcaoff_creds["creds"]["username"], username = tcaoff_creds["creds"]["username"],
password = tcaoff_creds["creds"]["password"], password = tcaoff_creds["creds"]["password"],
debug_only_errors = False debug = True,
debug_only_errors = False if args.verbose else True,
) )
# Schedule the activities: # Schedule the activities:
asyncio.run(set_scheduler( asyncio.run(set_scheduler(
cosec_creds = cosec_creds, cosec_creds = cosec_creds,
tcaoff_client = tcaoff_client, tcaoff_client = tcaoff_client,
test_mode = False test_mode = args.test
)) ))