GRM-20: refactor: use http.HTTPStatus constants instead of magic numbers

This commit is contained in:
Emil Simeonov
2026-06-19 19:36:08 +02:00
parent e1b589efab
commit b2acaefaf9
2 changed files with 6 additions and 4 deletions
+2 -1
View File
@@ -4,6 +4,7 @@
Usage:
GITEA_ADMIN_TOKEN=<token> python3 scripts/configure_repo.py
"""
import http
import os
import click
@@ -104,7 +105,7 @@ def _handle_http_error(e: requests.HTTPError) -> None:
"""Raise a user-friendly Click exception for HTTP errors."""
response = e.response
status = response.status_code if response else 0
if status == 403:
if status == http.HTTPStatus.FORBIDDEN:
raise click.ClickException(
_(
"HTTP {status} Forbidden — your token lacks admin rights.\n"