INNER CODE UNIT · Python
method_color
Far-Se/tabame · plugins/api-client/main.py:167
def method_color(m):
return {
"GET": "#22C55E",
"POST": "#3B82F6",
"PUT": "#F59E0B",
"PATCH": "#A855F7",
"DELETE": "#EF4444",
"HEAD": "#6B7280",
"OPTIONS": "#6B7280",
}.get((m or "").upper(), "#6B7280")
def response_outcome(result):
if not result.get("ok"):
return "Network Error", "#EF4444"
status = result.get("status", 0)
if status < 400:
return "Success", "#22C55E"