#19 /export endpoint
This commit is contained in:
parent
a32fcd3001
commit
01df427e8c
|
|
@ -9,6 +9,7 @@ from amarillo.plugins.enhancer.configuration import configure_enhancer_services
|
|||
from amarillo.app.utils.container import container
|
||||
from amarillo.app.models.Carpool import Carpool
|
||||
from amarillo.app.utils.utils import agency_carpool_ids_from_filename
|
||||
from amarillo.plugins.enhancer.services.export_router import export_router
|
||||
|
||||
logging.config.fileConfig('logging.conf', disable_existing_loggers=False)
|
||||
logger = logging.getLogger("enhancer")
|
||||
|
|
@ -70,6 +71,8 @@ def run_enhancer():
|
|||
logger.info("Goodbye Enhancer")
|
||||
|
||||
def setup(app):
|
||||
app.include_router(export_router)
|
||||
|
||||
thread = Thread(target=run_enhancer)
|
||||
thread.start()
|
||||
|
||||
|
|
|
|||
12
amarillo/plugins/enhancer/services/export_router.py
Normal file
12
amarillo/plugins/enhancer/services/export_router.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from fastapi import APIRouter, Depends
|
||||
from amarillo.app.routers.agencyconf import verify_admin_api_key
|
||||
from amarillo.plugins.enhancer.services.gtfs_generator import generate_gtfs
|
||||
|
||||
export_router = APIRouter(
|
||||
prefix="",
|
||||
tags=["export"]
|
||||
)
|
||||
|
||||
@export_router.post("/export")
|
||||
async def post_agency_conf(admin_api_key: str = Depends(verify_admin_api_key)):
|
||||
generate_gtfs()
|
||||
Loading…
Reference in a new issue