mediawiki_oauth: set User-Agent on all OAuth1Session instances so
Wikimedia doesn't reject token and API requests with 403; add timeout
parameter to api_post_request (default 4s).
mediawiki_api: add APIError exception; wrap .json() in call() to raise
APIError with status code and response body on decode failure; raise
timeout to 30s for edit POSTs.
api: wrap call_get_diff .json() with the same JSONDecodeError guard,
raising MediawikiError with HTTP status and body on failure.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Set User-Agent on OAuth1Session during token fetch and access token
exchange so Wikimedia doesn't reject the requests with 403
- Extract handle_post() from article_page() for clarity
- Catch api.MediawikiError in get_best_hit() to skip bad API responses
rather than crashing the page
- Catch mediawiki_api.APIError on save and return a 502 with the error
text instead of a 500 traceback
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>