aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/tasks/discovery.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-13 20:23:13 +0100
committerDennis Fink2026-11-13 20:23:13 +0100
commit8b6326f070c941510ebf1d27e53f501610406ea4 (patch)
tree1db02dbc58207e3ef557e8a6f6d7020363ef3c7b /webmentions_ssg/tasks/discovery.py
parent1f784f2b87ed0b2fd478e46d0d292c33f3150a3b (diff)
downloadwebmentions-ssg-8b6326f070c941510ebf1d27e53f501610406ea4.tar.gz
webmentions-ssg-8b6326f070c941510ebf1d27e53f501610406ea4.zip
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.
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/tasks/discovery.py3
1 files changed, 2 insertions, 1 deletions
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: