Skip to content

Instantly share code, notes, and snippets.

@hlfshell
Created November 11, 2010 13:37
Show Gist options
  • Save hlfshell/672511 to your computer and use it in GitHub Desktop.
Save hlfshell/672511 to your computer and use it in GitHub Desktop.
Wipe your twitter messages in your account
#! /usr/bin/env python
import twitter, time
from getpass import getpass
consumerKey = 'CONSUMERKEY'
consumerSecret = 'CONSUMERSECRET'
accessToken = 'ACCESSTOKEN'
accessSecret = 'ACCESSSECRET'
userName = raw_input('Please enter your username: ')
password = getpass('Please enter your password: ')
twitterService = twitter.Api(consumerKey, consumerSecret, accessToken, accessSecret)
#Check to see if we connected and run the program only while we have connections.
while True:
try:
twitterService.VerifyCredentials()
except:
print 'Connection to twitter lost'
break
twitterUser = twitterService.GetUser(userName)
tmpStatus = twitterUser.GetStatus()
for count in range(twitterUser.GetStatusesCount()):
try:
tmpStatus = twitterService.GetUserTimeline(userName, max_id = tmpStatus.GetId())[0]
print tmpStatus.GetText()
print twitterService.DestroyStatus(tmpStatus.GetId())
except:
print 'Failed. Waiting for a bit.'
time.sleep(5)
if count % 10 == 0:
print 'On status #' + str(count)
break
print 'Complete!'
@hlfshell
Copy link
Author

This doesn't work anymore- it's ancient code back on Twitter's 1.0 auth/api. Kept up for... prosperity?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment