diff --git a/data-loading-service/app/config.py b/data-loading-service/app/config.py index 6b95b8f..0f3a082 100644 --- a/data-loading-service/app/config.py +++ b/data-loading-service/app/config.py @@ -4,8 +4,12 @@ try: if os.path.isfile('app/secrets.py'): print('Loading secrets from secrets.py') - from .secrets import load_secrets - load_secrets() + try: + from .secrets import load_secrets + load_secrets() + except ModuleNotFoundError: + logging.info('No secrets.py found, loading from environment variables') + pass except ModuleNotFoundError: logging.info('No secrets.py found, loading from environment variables') pass diff --git a/fastapi/app/main.py b/fastapi/app/main.py index 92e3b4f..6a46095 100644 --- a/fastapi/app/main.py +++ b/fastapi/app/main.py @@ -271,7 +271,7 @@ async def get_trip_detail(agency_id: AgencyIdEnum, vehicle_id: str, geojson:bool -@app.get("/{agency_id}/trip_detail/route_code/{route_code}",tags=["Real-Time data","Static Data"]) +@app.get("/{agency_id}/trip_detail/route_code/{route_code}",tags=["Real-Time data"]) async def get_trip_detail_by_route_code(agency_id: AgencyIdEnum, route_code: str, geojson:bool=False,db: Session = Depends(get_db)): result = crud.get_gtfs_rt_vehicle_positions_trip_data_by_route_code(db,route_code,geojson,agency_id.value) # crud.get_gtfs_rt_vehicle_positions_by_field_name(db,vehicle_id,geojson,agency_id.value) @@ -340,7 +340,7 @@ async def get_line_detail_updates_for_route_code(websocket: WebSocket,agency_id: await websocket.close() @app.get("/{agency_id}/trip_detail_route_code/{route_code}",tags=["Real-Time data"]) -async def get_trip_detail(agency_id: AgencyIdEnum, route_code: str, geojson:bool=False,db: Session = Depends(get_db)): +async def get_trip_detail_and_route_code(agency_id: AgencyIdEnum, route_code: str, geojson:bool=False,db: Session = Depends(get_db)): result_array = [] temp_result = crud.get_gtfs_rt_vehicle_positions_trip_data_by_route_code(db,route_code,geojson,agency_id.value) if len(temp_result) == 0: @@ -507,16 +507,6 @@ async def live_get_gtfs_rt_trip_details(websocket: WebSocket,agency_id: AgencyId # await websocket.send_json(payload) # await asyncio.sleep(10) -@app.get("/{agency_id}/trip_detail_route_code/{route_code}",tags=["Real-Time data"]) -async def get_trip_detail(agency_id: AgencyIdEnum, route_code: str, geojson:bool=False,db: Session = Depends(get_db)): - result_array = [] - temp_result = crud.get_gtfs_rt_vehicle_positions_trip_data_by_route_code(db,route_code,geojson,agency_id.value) - if len(temp_result) == 0: - temp_result = { "message": "route'" + route_code + "' has no live trips'" } - return temp_result - result_array.append(temp_result) - return result_array - # Frontend Routing @app.get("/websocket_test") def read_root(request: Request):