diff --git a/main.py b/main.py index 31fc79a..e2aef86 100755 --- a/main.py +++ b/main.py @@ -354,7 +354,6 @@ class CategoryResult: articles: list[ArticleWithoutImage] gcmcontinue: str | None - error: str | None = None # Common non-content images to ignore when checking if an article has images @@ -436,7 +435,6 @@ def get_articles_without_images( articles_without_images: list[ArticleWithoutImage] = [] seen_pageids: set[int] = set() next_gcmcontinue: str | None = None - error: str | None = None # Build initial continue params from the external pagination token continue_params: dict[str, str] = {} @@ -453,21 +451,8 @@ def get_articles_without_images( ) response.raise_for_status() data = response.json() - if api_error := data.get("error"): - raise requests.RequestException( - f"{api_error.get('code', 'unknown')}: " - f"{api_error.get('info', 'unknown Wikipedia API error')}" - ) except (requests.RequestException, json.JSONDecodeError) as e: print(f"Wikipedia API error: {e}") - if articles_without_images: - error = ( - "Wikipedia stopped responding before the whole category could " - "be checked. Showing partial results. " - f"Wikipedia API error: {e}" - ) - else: - error = f"Unable to load articles. Wikipedia API error: {e}" break pages = data.get("query", {}).get("pages", {}) @@ -506,7 +491,6 @@ def get_articles_without_images( return CategoryResult( articles=articles_without_images, gcmcontinue=next_gcmcontinue, - error=error, ) @@ -774,7 +758,6 @@ def start() -> str: "combined.html", name=name, enwp=enwp, - wikipedia_url=wikipedia_url, search_result=search_result, cat=cat, flickr_search=flickr_search, @@ -907,7 +890,6 @@ def category_search() -> str: category_name=category_name, articles=result.articles, gcmcontinue=result.gcmcontinue, - error=result.error, ) diff --git a/templates/category.html b/templates/category.html index 2fe8df8..62fcb1a 100644 --- a/templates/category.html +++ b/templates/category.html @@ -50,7 +50,7 @@ {% endif %} - {% elif not error %} + {% else %}
Wikipedia article: {{ name }}
+Wikipedia article: {{ name }}
{% if wikipedia_extract %}{{ wikipedia_extract }}
{% endif %}