aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/tasks/discovery.py
diff options
context:
space:
mode:
Diffstat (limited to 'webmentions_ssg/tasks/discovery.py')
-rw-r--r--webmentions_ssg/tasks/discovery.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/webmentions_ssg/tasks/discovery.py b/webmentions_ssg/tasks/discovery.py
index 29c3e81..456e47e 100644
--- a/webmentions_ssg/tasks/discovery.py
+++ b/webmentions_ssg/tasks/discovery.py
@@ -11,7 +11,12 @@ import httpx
from bs4 import BeautifulSoup
from flask import current_app
-from ..net import is_http_url, is_temporary_status, read_limited_body
+from ..net import (
+ ResponseTooLargeError,
+ is_http_url,
+ is_temporary_status,
+ read_limited_body,
+)
LINK_SPLIT = re.compile(r",\s*(?=<)")
DISCOVERY_HEADERS = {"Accept": "text/html, application/xhtml+xml;q=0.9"}
@@ -130,7 +135,7 @@ def read_target_body(response: httpx.Response) -> bytes:
return read_limited_body(
response, current_app.config["MAX_TARGET_BYTES"], label="Target"
)
- except ValueError as exc:
+ except ResponseTooLargeError as exc:
raise PermanentSenderError(str(exc)) from exc
@@ -149,7 +154,7 @@ def discover_webmention_endpoint(client: httpx.Client, target: str) -> str | Non
"""
try:
head_response = client.head(target, headers=DISCOVERY_HEADERS)
- except httpx.RequestError, TemporarySenderError:
+ except httpx.RequestError:
# HEAD is only an optimization. Servers and intermediaries may reject
# or drop it even when fetching the document with GET would succeed.
pass