fix(rewrite): make image upload non-fatal and add rewrite tracing logs

- wordpress.py: catch image download/upload failures and skip image
  instead of aborting the entire WP draft update
- pipeline.py: add INFO logs at each step of _do_rewrite_and_draft
  to trace OpenAI call, tag generation, and WP API call
- telegram_bot.py: add INFO logs around rewrite execution + exc_info
  on error for full traceback in logs
- repositories.py: include scheduled_publish_at in get_article_by_id

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OliverGiertz 2026-03-26 07:45:55 +00:00
parent 12932bca90
commit 1963e32ab4
5 changed files with 42 additions and 9 deletions

View file

@ -318,13 +318,19 @@ def publish_article_draft(article: dict[str, Any]) -> tuple[int, str | None]:
featured_media_id = None
selected_image_url = _selected_image_url_from_meta(article.get("meta_json"))
if selected_image_url:
featured_media_id = _upload_featured_media(
base_url=settings.wordpress_base_url,
auth_header=auth,
image_url=selected_image_url,
article_title=title,
source_url=source_url,
)
try:
featured_media_id = _upload_featured_media(
base_url=settings.wordpress_base_url,
auth_header=auth,
image_url=selected_image_url,
article_title=title,
source_url=source_url,
)
except Exception as img_exc:
import logging
logging.getLogger(__name__).warning(
"Bild-Upload fehlgeschlagen (wird übersprungen): %s%s", selected_image_url, img_exc
)
payload = {
"title": title,