GRM-20: refactor: use http.HTTPStatus constants instead of magic numbers
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user