From 8b6326f070c941510ebf1d27e53f501610406ea4 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Fri, 13 Nov 2026 20:23:13 +0100 Subject: refactor(core): replace HTTP status magic numbers Use `HTTPStatus` constants for standard response codes and a named upper bound for retryable server errors so network and task status handling is self-documenting. --- webmentions_ssg/tasks/discovery.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'webmentions_ssg/tasks/discovery.py') diff --git a/webmentions_ssg/tasks/discovery.py b/webmentions_ssg/tasks/discovery.py index 456e47e..107d30a 100644 --- a/webmentions_ssg/tasks/discovery.py +++ b/webmentions_ssg/tasks/discovery.py @@ -5,6 +5,7 @@ """Discover a target Webmention endpoint and submit a POST.""" import re +from http import HTTPStatus from urllib.parse import urljoin import httpx @@ -198,7 +199,7 @@ def post_webmention( ) as response: status_url = None - if response.status_code == 201 and ( + if response.status_code == HTTPStatus.CREATED and ( location := response.headers.get("Location") ): try: -- cgit v1.3.1