diff options
| author | Dennis Fink | 2026-11-13 20:23:13 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-13 20:23:13 +0100 |
| commit | 8b6326f070c941510ebf1d27e53f501610406ea4 (patch) | |
| tree | 1db02dbc58207e3ef557e8a6f6d7020363ef3c7b /webmentions_ssg/tasks/discovery.py | |
| parent | 1f784f2b87ed0b2fd478e46d0d292c33f3150a3b (diff) | |
| download | webmentions-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 'webmentions_ssg/tasks/discovery.py')
| -rw-r--r-- | webmentions_ssg/tasks/discovery.py | 3 |
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: |
