use http.HTTPStatus for readability
This commit is contained in:
+2
-1
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user