except Exception, err: droid.eventPost('error', err) pass if __name__ == '__main__': ROOT_DIR = os.path.dirname(os.path.realpath(__file__)) #initialize android api droid. makeToast('starting tweet2speech!') droid.webViewShow(os.path.join(ROOT_DIR, "gui/interface.html")) hashtags = [] result = droid.eventWaitFor('conf').result controlReader = droid.eventWaitFor('controlReader').result state = controlReader['data'] configuration = json.loads(result['data']) user = configuration['username'] password = configuration['password'] hashtags.append(configuration['hashtag']) processTweet = Process(hashtags) #setup twitter connection if state: droid.eventPost('readerState','Reader started') stream = twitstream.track(user, password, processTweet, hashtags) stream.run()
return text # leave as is if __name__ == '__main__': twitstream.parser.usage = USAGE (options, args) = twitstream.parser.parse_args() twitstream.ensure_credentials(options) if len(args) < 1: args = ['love', 'hate', 'think', 'believe', 'feel', 'wish'] prettyprint = Formatter(args) stream = twitstream.track(options.username, options.password, prettyprint, args, options.debug, engine=options.engine) stream.run() ########NEW FILE######## __FILENAME__ = twitstream - test #!/usr/bin/env python import twitstream (options, args) = twitstream.parser.parse_args() if len(args) < 1: twitstream.parser.error("requires one method argument")
except KeyError: pass return text # leave as is if __name__ == '__main__': twitstream.parser.usage = USAGE (options, args) = twitstream.parser.parse_args() twitstream.ensure_credentials(options) if len(args) < 1: args = ['love', 'hate', 'think', 'believe', 'feel', 'wish'] prettyprint = Formatter(args) stream = twitstream.track(options.username, options.password, prettyprint, args, options.debug, engine=options.engine) stream.run() ########NEW FILE######## __FILENAME__ = twitstream-test #!/usr/bin/env python import twitstream (options, args) = twitstream.parser.parse_args() if len(args) < 1: twitstream.parser.error("requires one method argument") else: method = args[0]