use http.HTTPStatus for readability

This commit is contained in:
2026-05-29 21:48:19 +02:00
parent 40e933de23
commit 56d9653653
+2 -1
View File
@@ -1,4 +1,5 @@
from datetime import datetime
from http import HTTPStatus
from typing import Any
import pandas as pd
@@ -20,7 +21,7 @@ def append(beamline: Beamline, pgroup: PGroup, run: int, row: dict[str, Any]):
run_exists = not lib.read(pgroup, date_range=index, columns=[]).data.index.empty
if run_exists:
raise HTTPException(409, f"run {run} exists already in {beamline}/{pgroup}")
raise HTTPException(HTTPStatus.CONFLICT, f"run {run} exists already in {beamline}/{pgroup}")
timestamp = row.pop("timestamp", None)
timestamp = datetime.fromisoformat(timestamp) if timestamp else datetime.now()