Merge pull request #10 from MarkEEaton/rate-limit-notification

Rate limit notification
This commit is contained in:
Hugh Rundle 2019-05-19 09:41:43 +10:00 committed by GitHub
commit cc35769d83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -67,6 +67,10 @@ def checkToots(timeline, deleted_count=0):
deleted_count += 1
# unreblog the original toot (their toot), not the toot created by boosting (your toot)
if not options.test:
if mastodon.ratelimit_remaining == 0:
print(
"Rate limit reached. Waiting for a rate limit reset..."
)
mastodon.status_unreblog(toot.reblog)
else:
print(
@ -80,6 +84,10 @@ def checkToots(timeline, deleted_count=0):
2
) # wait 2 secs between deletes to be a bit nicer to the server
if not options.test:
if mastodon.ratelimit_remaining == 0:
print(
"Rate limit reached. Waiting for a rate limit reset..."
)
mastodon.status_delete(toot)
except MastodonError as e:
print("🛑 ERROR deleting toot - " + str(toot.id) + " - " + e.args[3])