make rate limit check only for non-test runs
This commit is contained in:
parent
2f1a34852e
commit
6354876d53
|
@ -67,6 +67,10 @@ def checkToots(timeline, deleted_count=0):
|
||||||
deleted_count += 1
|
deleted_count += 1
|
||||||
# unreblog the original toot (their toot), not the toot created by boosting (your toot)
|
# unreblog the original toot (their toot), not the toot created by boosting (your toot)
|
||||||
if not options.test:
|
if not options.test:
|
||||||
|
if mastodon.ratelimit_remaining == 0:
|
||||||
|
print(
|
||||||
|
"Rate limit reached. Waiting for a rate limit reset..."
|
||||||
|
)
|
||||||
mastodon.status_unreblog(toot.reblog)
|
mastodon.status_unreblog(toot.reblog)
|
||||||
else:
|
else:
|
||||||
print(
|
print(
|
||||||
|
@ -79,9 +83,11 @@ def checkToots(timeline, deleted_count=0):
|
||||||
time.sleep(
|
time.sleep(
|
||||||
2
|
2
|
||||||
) # wait 2 secs between deletes to be a bit nicer to the server
|
) # wait 2 secs between deletes to be a bit nicer to the server
|
||||||
if mastodon.ratelimit_remaining == 0:
|
|
||||||
print("Rate limit reached. Waiting for a rate limit reset...")
|
|
||||||
if not options.test:
|
if not options.test:
|
||||||
|
if mastodon.ratelimit_remaining == 0:
|
||||||
|
print(
|
||||||
|
"Rate limit reached. Waiting for a rate limit reset..."
|
||||||
|
)
|
||||||
mastodon.status_delete(toot)
|
mastodon.status_delete(toot)
|
||||||
except MastodonError as e:
|
except MastodonError as e:
|
||||||
print("🛑 ERROR deleting toot - " + str(toot.id) + " - " + e.args[3])
|
print("🛑 ERROR deleting toot - " + str(toot.id) + " - " + e.args[3])
|
||||||
|
|
Loading…
Reference in New Issue