reformat for nicer code using black
This commit is contained in:
parent
9844486601
commit
6b26940ee9
|
@ -38,7 +38,11 @@ if options.test:
|
||||||
|
|
||||||
print("Fetching account details...")
|
print("Fetching account details...")
|
||||||
|
|
||||||
mastodon = Mastodon(access_token=config.access_token, api_base_url=config.base_url, ratelimit_method="wait")
|
mastodon = Mastodon(
|
||||||
|
access_token=config.access_token,
|
||||||
|
api_base_url=config.base_url,
|
||||||
|
ratelimit_method="wait",
|
||||||
|
)
|
||||||
|
|
||||||
cutoff_date = datetime.now(timezone.utc) - timedelta(days=config.days_to_keep)
|
cutoff_date = datetime.now(timezone.utc) - timedelta(days=config.days_to_keep)
|
||||||
user_id = mastodon.account_verify_credentials().id
|
user_id = mastodon.account_verify_credentials().id
|
||||||
|
@ -72,19 +76,21 @@ def checkToots(timeline, deleted_count=0):
|
||||||
+ toot.created_at.strftime("%d %b %Y")
|
+ toot.created_at.strftime("%d %b %Y")
|
||||||
)
|
)
|
||||||
deleted_count += 1
|
deleted_count += 1
|
||||||
time.sleep(2) # wait 2 secs between deletes to be a bit nicer to the server
|
time.sleep(
|
||||||
|
2
|
||||||
|
) # wait 2 secs between deletes to be a bit nicer to the server
|
||||||
if not options.test:
|
if not options.test:
|
||||||
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])
|
||||||
print("Waiting 1 minute before re-trying...")
|
print("Waiting 1 minute before re-trying...")
|
||||||
time.sleep(
|
time.sleep(60)
|
||||||
60
|
|
||||||
)
|
|
||||||
try:
|
try:
|
||||||
print("Attempting delete again")
|
print("Attempting delete again")
|
||||||
mastodon.status_delete(toot)
|
mastodon.status_delete(toot)
|
||||||
time.sleep(2) # wait 2 secs between deletes to be a bit nicer to the server
|
time.sleep(
|
||||||
|
2
|
||||||
|
) # wait 2 secs between deletes to be a bit nicer to the server
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("🛑 ERROR deleting toot - " + str(toot.id))
|
print("🛑 ERROR deleting toot - " + str(toot.id))
|
||||||
print(e)
|
print(e)
|
||||||
|
|
Loading…
Reference in New Issue