Nenne in der Paperless-Fehlermeldung Statuscode, Pfad und Grund, damit sich eine abgelehnte Abfrage zuordnen lässt.
Deploy Development / deploy (push) Successful in 50s
Test Suite / pytest-backend (push) Failing after 7s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 26s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
StommerandClaude Sonnet 5.5 committed 2026-10-24 22:53:46 +02:00
1 parent 38406d3293
commit 0f2b7a8fab
2 files changed
+43 -1

No files matched your search

+12 -1
View File
@@ -1014,11 +1014,22 @@ def _paperless_get(base: str, token: str, path: str, params: dict) -> dict:
except HTTPError as exc:
if exc.code in {401, 403}:
raise unprocessable("Paperless hat den Schlüssel abgelehnt.") from exc
raise unprocessable("Paperless hat die Anfrage nicht beantwortet.") from exc
raise unprocessable(f"Paperless hat die Anfrage nicht beantwortet ({_refusal(exc, path)}).") from exc
except (URLError, TimeoutError, json.JSONDecodeError) as exc:
raise unprocessable("Paperless ist nicht erreichbar.") from exc
def _refusal(exc: HTTPError, path: str) -> str:
"""Status and, when Paperless names one, its reason. The body is the owner's own instance, cut short."""
reason = ""
try:
body = json.loads(exc.read(2000).decode("utf-8", "replace"))
reason = json.dumps(body, ensure_ascii=False)[:240] if isinstance(body, (dict, list)) else ""
except (ValueError, OSError):
reason = ""
return f"HTTP {exc.code} auf {path}" + (f": {reason}" if reason else "")
def _correspondent(doc: dict, names: dict | None = None) -> str | None:
value = doc.get("correspondent_name") or doc.get("correspondent")
if isinstance(value, str) and value.strip():