]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
🌐 Add German translation for `docs/de/docs/reference/status.md` (#10815)
authorNils Lindemann <nilslindemann@tutanota.com>
Sat, 30 Mar 2024 18:17:17 +0000 (19:17 +0100)
committerGitHub <noreply@github.com>
Sat, 30 Mar 2024 18:17:17 +0000 (13:17 -0500)
docs/de/docs/reference/status.md [new file with mode: 0644]

diff --git a/docs/de/docs/reference/status.md b/docs/de/docs/reference/status.md
new file mode 100644 (file)
index 0000000..1d9458e
--- /dev/null
@@ -0,0 +1,36 @@
+# Statuscodes
+
+Sie können das Modul `status` von `fastapi` importieren:
+
+```python
+from fastapi import status
+```
+
+`status` wird direkt von Starlette bereitgestellt.
+
+Es enthält eine Gruppe benannter Konstanten (Variablen) mit ganzzahligen Statuscodes.
+
+Zum Beispiel:
+
+* 200: `status.HTTP_200_OK`
+* 403: `status.HTTP_403_FORBIDDEN`
+* usw.
+
+Es kann praktisch sein, schnell auf HTTP- (und WebSocket-)Statuscodes in Ihrer Anwendung zuzugreifen, indem Sie die automatische Vervollständigung für den Namen verwenden, ohne sich die Zahlen für die Statuscodes merken zu müssen.
+
+Lesen Sie mehr darüber in der [FastAPI-Dokumentation zu Response-Statuscodes](../tutorial/response-status-code.md).
+
+## Beispiel
+
+```python
+from fastapi import FastAPI, status
+
+app = FastAPI()
+
+
+@app.get("/items/", status_code=status.HTTP_418_IM_A_TEAPOT)
+def read_items():
+    return [{"name": "Plumbus"}, {"name": "Portal Gun"}]
+```
+
+::: fastapi.status