O'Reilly logo

Mastering Python for Data Science by Samir Madhavan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required