Study Python – Tweet scraping, writing and sentiment evaluation utilizing tweepy and textblob in python

Tweepy is open-sourced, hosted on GitHub and enables Python to communicate with Twitter platform and use its API. Tweepy supports OAuth authentication. Authentication is handled by the tweepy.AuthHandler class.

TextBlob is a Python (2 and 3) library for processing textual data. It provides a simple API for diving into common natural language processing (NLP) tasks such as part-of-speech tagging, noun phrase extraction, sentiment analysis, classification, translation, and more.

TextBlob’s polarity attribute tells the attitude of phrase on the scale [-1.0 to 1.0] where -1.0 stands for negative and 1.0 stands for positive.
TextBlob’s subjectivity is a float within the range [0.0, 1.0] where 0.0 is very objective and 1.0 is very subjective.

Here is simple way how to access twitter data and write it into CSV file  and perform sentiment analysis using textblob library.

To get your own consumer key, consumer secret key, access token and access secret key please goto:

  • http://apps.twitter.com login using your own twitter credential
  • Create a new app button there and enter app name, app description and check the I agree hit submit you’ll get the necessary details after successful submission
  • Remeber when giving app name at twitter dec page never include tweet word and it also demand for app name to be unique just like twitter userid

which will generate a fantastic csv file like this.

Python Programs On Demand ‘Free’