fix
This commit is contained in:
@@ -410,6 +410,12 @@ def post_engagement_tweet():
|
||||
logging.warning(f"Daily post limit (20) reached for {username}, skipping")
|
||||
continue
|
||||
|
||||
# Check user activity before posting
|
||||
credentials = X_API_CREDENTIALS.get(username)
|
||||
if credentials:
|
||||
from foodie_utils import check_user_activity
|
||||
check_user_activity(username, credentials)
|
||||
|
||||
tweet = generate_engagement_tweet(author)
|
||||
if not tweet:
|
||||
logging.error(f"Failed to generate engagement tweet for {username}, skipping")
|
||||
|
||||
+4
-4
@@ -281,11 +281,11 @@ def post_tweet(author, tweet, reply_to_id=None):
|
||||
in_reply_to_tweet_id=reply_to_id
|
||||
)
|
||||
# Log rate limit headers on success
|
||||
if hasattr(client, 'session') and client.session.last_response:
|
||||
if hasattr(response, '_response') and response._response: # Access the underlying response
|
||||
rate_limit_headers = {
|
||||
"x-rate-limit-limit": client.session.last_response.headers.get("x-rate-limit-limit"),
|
||||
"x-rate-limit-remaining": client.session.last_response.headers.get("x-rate-limit-remaining"),
|
||||
"x-rate-limit-reset": client.session.last_response.headers.get("x-rate-limit-reset"),
|
||||
"x-rate-limit-limit": response._response.headers.get("x-rate-limit-limit"),
|
||||
"x-rate-limit-remaining": response._response.headers.get("x-rate-limit-remaining"),
|
||||
"x-rate-limit-reset": response._response.headers.get("x-rate-limit-reset"),
|
||||
}
|
||||
logging.debug(f"Rate limit headers after posting for {username}: {rate_limit_headers}")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user