#!/usr/bin/python2 from birdy.twitter import AppClient from time import sleep import serial APP_KEY = 'txcGyqZMRGMSAiSA2DiKxP7Xx' APP_SECRET = 'gFDF3oaI1eLAd3Oz0wZXgwVGnAah01ilmbrTCdxhPhuxl0YywO' ACCESS_TOKEN = '530013111-hiD4FtSbEA5exkpr0487DFCNyNptOL7VLFWPpnAu' ACCESS_TOKEN_SECRET = 'fX9pqACLXyHhkhUCEYSxY4G4oIBE0H6XqsB6FqweGIlzQ' PREAMBLE = '\xD5' EOF = '\x04' try: ser = serial.Serial(0, 9600) except: pass def tx(data): print data try: ser.write(PREAMBLE+data+EOF) except: pass sleep(0.1); #Give the Manchester transmitter some time to transmit. client = AppClient(APP_KEY, APP_SECRET) client.get_access_token() #Not sure if I need to do this... echoed = [] while True: response = client.api.search.tweets.get(q='%23ECE491') returned = response.data.statuses for index in range(len(returned)-1, -1, -1): status = returned[index] if status.id_str not in echoed: echoed.append(status.id_str) tx(str(status.user.name)+": "+str(status.text)) print "Sleeping for 120s." sleep(120)