diff --git a/add_links/api.py b/add_links/api.py index 5d8de19..6f57def 100644 --- a/add_links/api.py +++ b/add_links/api.py @@ -81,6 +81,7 @@ def _get_active_session() -> requests.sessions.Session: return g.oauth_session # type: ignore[return-value] except RuntimeError: pass + print("WARNING: using unauthenticated session", file=sys.stderr) return get_session() @@ -96,7 +97,9 @@ def api_get(params: StrDict) -> StrDict: print(f"Response body: {r.text!r}", file=sys.stderr) if webpage_error in r.text: raise MediawikiError(webpage_error) - raise MediawikiError(f"HTTP {r.status_code}: unexpected response from Wikipedia API") + if r.status_code == 429: + raise MediawikiError("Wikipedia rate limit exceeded — wait a moment and try again.") + raise MediawikiError(f"HTTP {r.status_code}: {r.text[:200]!r}") check_for_error(ret) return ret diff --git a/templates/index.html b/templates/index.html index af5314b..11c14ec 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,12 +1,12 @@ {% extends "base.html" %} -{% block title %}Find Link{% endblock %} +{% block title %}Missing Link{% endblock %} {% block content %}
-

Find Link

+

Missing Link

Find unlinked mentions of a Wikipedia article and add the links.