Shane 7 months ago
parent 677c9b646d
commit b5417f3397
  1. 4
      foodie_utils.py

@ -456,7 +456,6 @@ def upload_image_to_wp(image_url, post_title, wp_base_url, wp_username, wp_passw
logging.error(f"Failed to fetch image {image_url} after retries") logging.error(f"Failed to fetch image {image_url} after retries")
return None return None
# Only proceed if image_response is defined (i.e., the fetch succeeded)
if image_response is None: if image_response is None:
logging.error(f"Image response is None for {image_url}, cannot proceed with upload") logging.error(f"Image response is None for {image_url}, cannot proceed with upload")
return None return None
@ -470,7 +469,8 @@ def upload_image_to_wp(image_url, post_title, wp_base_url, wp_username, wp_passw
image_id = response.json()["id"] image_id = response.json()["id"]
if page_url: if page_url:
caption = f'<a href="{page_url}">Image via {image_source}</a>' # Updated caption: "Image via" in grey, source name in default link color
caption = f'<span style="color: grey;">Image via </span><a href="{page_url}">{image_source}</a>'
else: else:
caption = image_source caption = image_source
requests.post( requests.post(

Loading…
Cancel
Save