Delete All Tweets With Python

impshum(43)
Published in
#python
Words
76
Reading
1 min
7y
Listen to this post
~1 min

Zskj9C56UonWToSX8tGXNY8jeXKSedJ2aRhGRj6HDecqrgGjZ2GHp5mopZTCbDGZ54kMVAsp1EyLGocHMypa3efBPtmY3o4yuq1SAsjDqeAtB5vi3csg.jpeg

Using Tweepy to clear all tweets



If there's any need for deleting all your posts from Twitter here's a handy snippet to help you do such a thing.

import tweepy


consumer_key = 'XXXX'
consumer_secret = 'XXXX'
access_key = 'XXXX'
access_secret = 'XXXX'

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_key, access_secret)

api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)

for status in tweepy.Cursor(api.user_timeline).items():
    id = status.id
    try:
        api.destroy_status(id)
        print(f'Deleted: {id}')
    except:
        print(f'Failed: {id}')



Thanks for reading. x

Resources

Delete All Tweets With Python | Ecency