kaledonya clips: a Discord-friendly clip site on top of Zipline
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
commit
e6f8905377
34 files changed
+2917
No files matched your search
@@ -0,0 +1,15 @@
|
||||
"""JSON error responses shared by /upload and the site API."""
|
||||
import httpx
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
|
||||
def error(status: int, message: str) -> JSONResponse:
|
||||
return JSONResponse({"error": message}, status_code=status)
|
||||
|
||||
|
||||
def zipline_message(r: httpx.Response) -> str:
|
||||
try:
|
||||
body = r.json()
|
||||
return str(body.get("error") or body.get("message") or body)
|
||||
except ValueError:
|
||||
return r.text[:200] or f"Zipline returned {r.status_code}"
|
||||
Reference in new issue
Block a user