-
-
Save aknik/5fcc42278928f964718952d784d11833 to your computer and use it in GitHub Desktop.
Delete all twitter DMs using this python script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
# Go to dev.twitter.com/apps and create a new app; put the information here. | |
# You need the tweepy library. | |
consumer_secret = '' | |
consumer_key = '' | |
access_token_key = '' | |
access_token_secret = '' | |
import tweepy | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
auth.set_access_token(access_token_key, access_token_secret) | |
api = tweepy.API(auth) | |
def deleteDMs(): | |
while True: | |
dlist = api.direct_messages() | |
if len(dlist) >= 1: | |
for d in dlist: | |
print "Destroying " + d.text + "\n" | |
d.destroy() | |
else: | |
break | |
while True: | |
dlist = api.sent_direct_messages() | |
if(dlist) >= 1: | |
for d in dlist: | |
print "Destroying " + d.text + "\n" | |
d.destroy() | |
else: | |
break | |
deleteDMs() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment