(20260311) Cosec scripts can now accept custom file names for the credentials, but they must be in the same 'creds' directory.

This commit is contained in:
2026-03-11 11:23:52 +05:30
parent 0adb27bae3
commit e25daf5fd5
2 changed files with 26 additions and 4 deletions
+12 -2
View File
@@ -367,6 +367,16 @@ if __name__ == "__main__":
action = "store_true",
default = False,
)
ap.add_argument(
"--cosec-creds",
help = "The credentials JSON from which you would like to connect to COSEC.",
default = "cosec.json"
)
ap.add_argument(
"--tcaoff-creds",
help = "The credentials JSON from which you would like to connect to TheCAOffice.",
default = "tcaoff.json"
)
args = ap.parse_args()
# Explicitly mention the expected file paths for other devs to maintain:
@@ -375,8 +385,8 @@ if __name__ == "__main__":
print("TCAOFF CREDS:", common.TCAOFF_CREDS_FILE)
# Read required credentials:
cosec_creds = json.from_file(common.COSEC_CREDS_FILE)
tcaoff_creds = json.from_file(common.TCAOFF_CREDS_FILE)
cosec_creds = json.from_file(os.path.join(common.CREDS_DIR, args.cosec_creds))
tcaoff_creds = json.from_file(os.path.join(common.CREDS_DIR, args.tcaoff_creds))
# Create the clients:
tcaoff_client = AsyncTheCAOffice(
+14 -2
View File
@@ -210,6 +210,16 @@ if __name__ == "__main__":
help = "The date till when you want to sync attendance.",
default = date_time.get_current_ist_date_time()
)
ap.add_argument(
"--cosec-creds",
help = "The credentials JSON from which you would like to connect to COSEC.",
default = "cosec.json"
)
ap.add_argument(
"--tcaoff-creds",
help = "The credentials JSON from which you would like to connect to TheCAOffice.",
default = "tcaoff.json"
)
args = ap.parse_args()
# Explicitly mention the expected file paths for other devs to maintain:
@@ -218,13 +228,15 @@ if __name__ == "__main__":
print("TCAOFF CREDS:", common.TCAOFF_CREDS_FILE)
# Read required credentials:
cosec_creds = json.from_file(common.COSEC_CREDS_FILE)
tcaoff_creds = json.from_file(common.TCAOFF_CREDS_FILE)
cosec_creds = json.from_file(os.path.join(common.CREDS_DIR, args.cosec_creds))
tcaoff_creds = json.from_file(os.path.join(common.CREDS_DIR, args.tcaoff_creds))
# Date-handling:
args.from_date = date_time.parse_date_time(args.from_date, timezone = date_time.TIMEZONE_IST)
args.to_date = date_time.parse_date_time(args.to_date, timezone = date_time.TIMEZONE_IST)
if args.from_date > args.to_date: args.from_date, args.to_date = args.to_date, args.from_date
args.from_date = args.from_date.replace(hour = 0, minute = 0, second = 0, microsecond = 0)
args.to_date = args.to_date.replace(hour = 23, minute = 59, second = 59, microsecond = 999999)
print("From Date:", args.from_date)
print(" To Date:", args.to_date)
# dates_list = [args.from_date]