Before we start analyzing tweets, we'll need to install the Twython
package of Python, which helps interact with the Twitter API to get tweets from Twitter. This can be downloaded from https://github.com/ryanmcgrath/twython.
Also, you need to get the consumer key and consumer secret key from https://apps.twitter.com/app/new.
Once you have details about your app, you'll get the consumer key and consumer secret key:
After this, go to the Key and Access Tokens tab to generate your access token:
Once you have the required keys, we'll add the details to the following code:
#Please provide your keys here TWITTER_APP_KEY = 'XXXXXXXXXXXXXXXXXXXXX' TWITTER_APP_KEY_SECRET = 'XXXXXXXXXXXXXXXXXXXXX' TWITTER_ACCESS_TOKEN = 'XXXXXXXXXXXXXXXXXXXXX' TWITTER_ACCESS_TOKEN_SECRET = 'XXXXXXXXXXXXXXXXXXXXX' t = Twython(app_key=TWITTER_APP_KEY, app_secret=TWITTER_APP_KEY_SECRET, oauth_token=TWITTER_ACCESS_TOKEN, ...