try
This commit is contained in:
@@ -8,7 +8,7 @@ import fcntl
|
||||
import os
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from openai import OpenAI
|
||||
from foodie_utils import post_tweet, AUTHORS, SUMMARY_MODEL, check_author_rate_limit
|
||||
from foodie_utils import post_tweet, AUTHORS, SUMMARY_MODEL, check_author_rate_limit, load_json_file
|
||||
from foodie_config import X_API_CREDENTIALS, AUTHOR_BACKGROUNDS_FILE
|
||||
from dotenv import load_dotenv
|
||||
|
||||
@@ -162,13 +162,9 @@ def post_engagement_tweet():
|
||||
|
||||
for author in AUTHORS:
|
||||
# Check if the author can post before generating the tweet
|
||||
if check_author_rate_limit(author):
|
||||
reset_time = datetime.fromtimestamp(
|
||||
load_json_file('/home/shane/foodie_automator/rate_limit_info.json', default={})
|
||||
.get(author['username'], {})
|
||||
.get('tweet_reset', time.time()),
|
||||
tz=timezone.utc
|
||||
).strftime('%Y-%m-%d %H:%M:%S')
|
||||
can_post, remaining, reset = check_author_rate_limit(author)
|
||||
if not can_post:
|
||||
reset_time = datetime.fromtimestamp(reset, tz=timezone.utc).strftime('%Y-%m-%d %H:%M:%S') if reset else "Unknown"
|
||||
logging.info(f"Skipping engagement tweet for {author['username']} due to rate limit. Reset at: {reset_time}")
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user