diff --git a/scripts/cron.py b/scripts/cron.py index 4530aa5..2399582 100644 --- a/scripts/cron.py +++ b/scripts/cron.py @@ -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( diff --git a/scripts/manual_attendance.py b/scripts/manual_attendance.py index 16e85aa..ba20f77 100644 --- a/scripts/manual_attendance.py +++ b/scripts/manual_attendance.py @@ -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]