I need to read the day, at which the job should run, out of a config file. Therefore I need a way to specify the day in the scheduler as an argument. For example like this:
# how it could look like with a dynamic argument for the days:
schedule.every().day("monday").at("06:00").do(execute_job)
# vs. how I works right now with the day hardcoded:
schedule.every().monday.at("06:00").do(execute_job)
I didn't find a way to do that. The only workaround that I can think of is by using eval():
day = "monday"
eval(f"schedule.every().{day}('06:00').do(execute_job)")
As long as Im not missing anything, I think it would be nice if such a functionality is added.
I need to read the day, at which the job should run, out of a config file. Therefore I need a way to specify the day in the scheduler as an argument. For example like this:
I didn't find a way to do that. The only workaround that I can think of is by using
eval()
:As long as Im not missing anything, I think it would be nice if such a functionality is added.