Performing sentiment analysis on world leaders using Twitter

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.

Performing sentiment analysis on world leaders using Twitter

Once you have details about your app, you'll get the consumer key and consumer secret key:

Performing sentiment analysis on world leaders using Twitter

After this, go to the Key and Access Tokens tab to generate your access token: ...

Get Mastering Python for Data Science now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.