INNER CODE UNIT · Python

response_outcome

Far-Se/tabame · plugins/api-client/main.py:179

def response_outcome(result):
    if not result.get("ok"):
        return "Network Error", "#EF4444"
    status = result.get("status", 0)
    if status < 400:
        return "Success", "#22C55E"
    if status < 500:
        return "Client Error", "#F59E0B"
    return "Server Error", "#EF4444"


def human_size(n):
    if n is None:
        return "–"
    if n < 1024:
        return f"{n} B"
    if n < 1024 * 1024:
        return f"{n / 1024:.1f} KB"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…