internetarchive / internetarchive/openlibrary-bots

Need to handle Twitter rate limitations within code.

Open
#111 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
81
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Twitter allows 300 POSTS per 3 hours (~1.6 tweets per minute). We need to keep track of this so we don't handle mentions, and then fail to post because we have exceeded the limit. Ideally, we would not write to `last_seen_id.txt` so that if the limit is met, mentions will still be responded to once the tally is reset.

My possibly suggestions:
- Tally sent tweets and prohibit use if cap is met
```
while True:
if postLimitNotMet():
reply_to_tweets()
time.sleep(15)
```
- Only allow a certain number of ISBNs per tweet, I suggest just 1 for now. If, we have a 1 mention = 1 response behavior then I believe the bot would be less likely to be overloaded.

A side note: While unlikely, there could be an instance when borrowbot is maliciously spammed. It would be nice to have something that prevents such an action.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.