I have a flask application that has a job that runs every minute(sends a request to an endpoint and stores some data). But now i want to make a job that runs always in the last day of every month.
I already have stored the last day of every month
from datetime import datetime
import calendar
now = datetime.now()
year = now.year
month = now.month
lastDay = calendar.monthrange(year, month)[1]
I did a job but i am not sure if this works every month or just one time.
def graphs():
locale.setlocale(locale.LC_TIME, 'pt_PT.UTF-8')
getMonth()
scheduler = BackgroundScheduler()
scheduler.add_job(func=graphs, trigger='cron', year=year, month=month, day=lastDay)
scheduler.start()