import requests from ITS.api import gather_cctv_list from flask import Flask from flask_restx import Api from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.triggers.interval import IntervalTrigger API_ENDPOINT = "" app = Flask(__name__) print("ITS API Updater START") api = Api(app, version='0.1', title="monitoring", description="API Server", terms_url="/", contact="", ) def url_list_sender(): df = gather_cctv_list(129.2, 129.3, 35.9, 36.07, 1, "its", 1) df = df.drop("roadsectionid", axis=1) df = df.drop("cctvresolution", axis=1) df = df.drop("filecreatetime", axis=1) payload = df.T.to_json() requests.post(API_ENDPOINT, json=payload) url_list_sender() scheduler = BackgroundScheduler() scheduler.start() scheduler.add_job( func=url_list_sender, trigger=IntervalTrigger(hours=10), id='weather_data_update', name='update weather time every 6 hours', replace_existing=True )