Skip to content

Commit e9efdb9

Browse files
authored
Merge pull request #2 from rameezk/feat/do-not-proceed-when-no-tweets
If no tweets to delete do not proceed
2 parents 90f9f90 + 84a858e commit e9efdb9

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.formatting.provider": "black"
3+
}

scrub.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ def scrub_tweets():
2121
print(f"Getting tweets older than {older_than}")
2222
tweets = api.get_tweets(older_than=older_than)
2323

24+
if not tweets:
25+
print("No tweets to delete")
26+
return
27+
2428
total_tweets = len(tweets)
2529
failed_to_delete = 0
2630
for count, tweet in enumerate(tweets, start=1):
2731
print(f"Deleting tweet [{count}/{total_tweets}]")
32+
2833
try:
2934
is_deleted = api.delete_tweet_by_tweet_id(tweet["id"])
3035
if not is_deleted:

0 commit comments

Comments
 (0)