Skip to content

Commit

Permalink
Add get metadata to API
Browse files Browse the repository at this point in the history
  • Loading branch information
ugyballoons committed Sep 5, 2024
1 parent ecbb571 commit 3101c99
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions python/lsst/ts/rubintv/handlers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,24 @@ async def get_night_report_for_date(

nr = await historical.get_night_report_payload(location, camera, day_obs)
return nr


@api_router.get(
"/{location_name}/{camera_name}/metadata/{date_str}", repsonse_model=dict
)
async def get_metadata_for_date(
location_name: str, camera_name: str, date_str: str, request: Request
) -> dict:

historical: HistoricalPoller = request.app.state.historical
if await historical.is_busy():
raise HTTPException(423, "Historical data is being processed")

location, camera = await get_location_camera(location_name, camera_name, request)
if not camera.online:
raise HTTPException(status_code=404, detail="Camera not found.")

day_obs = date_validation(date_str)

metadata = await historical.get_metadata_for_date(location, camera, day_obs)
return metadata

0 comments on commit 3101c99

Please sign in to comment.