tweepy error python 2.7 -
i keep getting error:
tweepy.error.tweeperror: [{u'message': u'status duplicate.', u'code': 187
i have no clue why getting error have tried everything!
my main code is:
import socket urllib2 import urlopen, urlerror, httperror socket.setdefaulttimeout( 23 ) # timeout in seconds url = 'http://google.co.uk' try : response = urlopen( url ) except httperror, e: tweet_text = "raspberry pi server down!" textfile = open('/root/documents/server_check.txt','w') textfile.write("down") textfile.close() except urlerror, e: tweet_text = "raspberry pi server down!" textfile = open('/root/documents/server_check.txt','w') textfile.write("down") textfile.close() else : textfile = open('/root/documents/server_check.txt','r') if 'down' in open('/root/documents/server_check.txt').read(): tweet_text = "raspberry pi server up!" textfile = open('/root/documents/server_check.txt','w') textfile.write("up") textfile.close() elif 'up' in open('/root/documents/server_check.txt').read(): tweet_text = "" if len(tweet_text) <= 140: if tweet_text == "raspberry pi server down!" or tweet_text == "raspberry pi server up!": api.update_status(status=tweet_text) else: pass else: print "your message long!"
i have removed api's security reasons! have removed link server. appreciated!
thanks
the problem tweepy doesn't let tweet same tweet twice fix added these lines of code:
for status in tweepy.cursor(api.user_timeline).items(): try: api.destroy_status(status.id) except: pass
the code above deletes previous tweets next tweet doesn't fail.
i hope helps else!
Comments
Post a Comment