(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:
+12
-2
@@ -367,6 +367,16 @@ if __name__ == "__main__":
|
|||||||
action = "store_true",
|
action = "store_true",
|
||||||
default = False,
|
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()
|
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:
|
||||||
@@ -375,8 +385,8 @@ if __name__ == "__main__":
|
|||||||
print("TCAOFF CREDS:", common.TCAOFF_CREDS_FILE)
|
print("TCAOFF CREDS:", common.TCAOFF_CREDS_FILE)
|
||||||
|
|
||||||
# Read required credentials:
|
# Read required credentials:
|
||||||
cosec_creds = json.from_file(common.COSEC_CREDS_FILE)
|
cosec_creds = json.from_file(os.path.join(common.CREDS_DIR, args.cosec_creds))
|
||||||
tcaoff_creds = json.from_file(common.TCAOFF_CREDS_FILE)
|
tcaoff_creds = json.from_file(os.path.join(common.CREDS_DIR, args.tcaoff_creds))
|
||||||
|
|
||||||
# Create the clients:
|
# Create the clients:
|
||||||
tcaoff_client = AsyncTheCAOffice(
|
tcaoff_client = AsyncTheCAOffice(
|
||||||
|
|||||||
@@ -210,6 +210,16 @@ if __name__ == "__main__":
|
|||||||
help = "The date till when you want to sync attendance.",
|
help = "The date till when you want to sync attendance.",
|
||||||
default = date_time.get_current_ist_date_time()
|
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()
|
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:
|
||||||
@@ -218,13 +228,15 @@ if __name__ == "__main__":
|
|||||||
print("TCAOFF CREDS:", common.TCAOFF_CREDS_FILE)
|
print("TCAOFF CREDS:", common.TCAOFF_CREDS_FILE)
|
||||||
|
|
||||||
# Read required credentials:
|
# Read required credentials:
|
||||||
cosec_creds = json.from_file(common.COSEC_CREDS_FILE)
|
cosec_creds = json.from_file(os.path.join(common.CREDS_DIR, args.cosec_creds))
|
||||||
tcaoff_creds = json.from_file(common.TCAOFF_CREDS_FILE)
|
tcaoff_creds = json.from_file(os.path.join(common.CREDS_DIR, args.tcaoff_creds))
|
||||||
|
|
||||||
# Date-handling:
|
# Date-handling:
|
||||||
args.from_date = date_time.parse_date_time(args.from_date, timezone = date_time.TIMEZONE_IST)
|
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)
|
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
|
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("From Date:", args.from_date)
|
||||||
print(" To Date:", args.to_date)
|
print(" To Date:", args.to_date)
|
||||||
# dates_list = [args.from_date]
|
# dates_list = [args.from_date]
|
||||||
|
|||||||
Reference in New Issue
Block a user