hi sandy, yeh ive updated the library. thanks for checking :)
import sys
import time
import tweepy
import scrollphat
scrollphat.clear()
while True:
try:
scrollphat.set_brightness(2)
class MyStreamListener(tweepy.StreamListener):
def on_status(self, status):
if not status.text.startswith('RT'):
scroll_tweet(status)
def on_error(self, status_code):
if status_code == 420:
return False
def scroll_tweet(status):
status = ' >>>>> @%s: %s ' % (status.user.screen_name.upper(), status.text.upper())
status = status.encode('ascii', 'ignore').decode('ascii')
scrollphat.write_string(status)
status_length = scrollphat.buffer_len()
print status
print 'status length --->',status_length
print 'buffer_len --->',scrollphat.buffer_len()
while status_length > 0:
#print 'status length',status_length
#print 'buffer_len',scrollphat.buffer_len()
scrollphat.scroll()
time.sleep(0.06)
status_length -= 1
consumer_key =''
consumer_secret =''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
myStreamListener = MyStreamListener()
myStream = tweepy.Stream(auth = api.auth, listener=myStreamListener)
myStream.filter(track=['#saintsfc','@BBCSport'], async=False)
except KeyboardInterrupt:
scrollphat.clear()
sys.exit(-1)