from fastapi import FastAPI from database import Base, engine from routes import router from apscheduler.schedulers.background import BackgroundScheduler #from webscrapper import ejecutar_scrapper # Crear las tablas en MySQL si no existen Base.metadata.create_all(bind=engine) # Inicializar FastAPI app = FastAPI() scheduler = BackgroundScheduler() # Incluir rutas app.include_router(router) # @app.on_event("startup") # def startup_event(): # scheduler.add_job(ejecutar_scrapper, "interval", hours=24) # scheduler.start() # @app.on_event("shutdown") # def shutdown_event(): # scheduler.shutdown()