I am writing a Twitter program for a small market mood that I make for fun at Pyhon using the Tweepy library. However, my limited knowledge of API access and much more make most of the Twitter API documentation a little cryptic. I would like to know a few things, and if this is not the right place for these questions, please let me know so that I can post them elsewhere:
1) I do not have the application that I am writing. Is it possible to access the Streaming API without it? If so, how can I apply for a consumer and token access keys so that I can access the feed with Oauth2?
2) Is it possible to simply access my own Twitter channel with all my followers, and then follow a ton of people who I think will have relevant market information?
I currently have a quick program that I found on the Internet below, but obviously I am currently getting "Error: 401" because I do not have a client key or access key:
import tweepy import oauth2 consumer_key = '' consumer_secret = '' access_token_key = '' access_token_secret = '' auth1 = tweepy.OAuthHandler(consumer_key, consumer_secret) auth1.set_access_token(access_token_key, access_token_secret) class StreamListener(tweepy.StreamListener): def on_status(self, tweet): print 'Ran on_status' def on_error(self, status_code): print 'Error: ' + str(status_code) return False def on_data(self, data): print 'Ok, this is actually running' l = StreamListener() streamer = tweepy.Stream(auth=auth1, listener=l) setTerms = ['twitter'] streamer.filter(track=setTerms)
Any help is greatly appreciated - thanks.
EDIT: Should I just create a dummy application so that I can access the API?
source share