fix no tweet issue
This commit is contained in:
+4
-4
@@ -620,7 +620,7 @@ def get_wp_tag_id(tag_name, wp_base_url, wp_username, wp_password):
|
||||
logging.error(f"Failed to get WP tag ID for '{tag_name}': {e}")
|
||||
return None
|
||||
|
||||
def post_to_wp(post_data, category, link, author, image_url, original_source, image_source="Pixabay", uploader=None, pixabay_url=None, interest_score=4, post_id=None, post_tweet=True):
|
||||
def post_to_wp(post_data, category, link, author, image_url, original_source, image_source="Pixabay", uploader=None, pixabay_url=None, interest_score=4, post_id=None, should_post_tweet=True):
|
||||
wp_base_url = "https://insiderfoodie.com/wp-json/wp/v2"
|
||||
logging.info(f"Starting post_to_wp for '{post_data['title']}', image_source: {image_source}")
|
||||
|
||||
@@ -725,12 +725,12 @@ def post_to_wp(post_data, category, link, author, image_url, original_source, im
|
||||
timestamp = datetime.now(timezone.utc).isoformat()
|
||||
save_post_to_recent(post_data["title"], post_url, author["username"], timestamp)
|
||||
|
||||
# Post article tweet to X only if post_tweet is True
|
||||
if post_tweet:
|
||||
# Post article tweet to X only if should_post_tweet is True
|
||||
if should_post_tweet:
|
||||
try:
|
||||
post = {"title": post_data["title"], "url": post_url}
|
||||
tweet = generate_article_tweet(author, post, author["persona"])
|
||||
if post_tweet(author, tweet):
|
||||
if post_tweet(author, tweet): # Use the actual post_tweet function
|
||||
logging.info(f"Successfully posted article tweet for {author['username']} on X")
|
||||
else:
|
||||
logging.warning(f"Failed to post article tweet for {author['username']} on X")
|
||||
|
||||
Reference in New Issue
Block a user