From 56d9653653f4fdfff2217287c53e040f6e7a3349 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Fri, 29 May 2026 21:48:19 +0200 Subject: [PATCH] use http.HTTPStatus for readability --- stand/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stand/api.py b/stand/api.py index afd00ea..54c0654 100644 --- a/stand/api.py +++ b/stand/api.py @@ -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()