Skip to content

Instantly share code, notes, and snippets.

@grafuls
Created October 30, 2016 07:24
Show Gist options
  • Save grafuls/7d7c73a7ede3c7e29d0b6c37370a2861 to your computer and use it in GitHub Desktop.
Save grafuls/7d7c73a7ede3c7e29d0b6c37370a2861 to your computer and use it in GitHub Desktop.
Tweeter sentiment analysis
from textblob import TextBlob
from tweepy import API
from tweepy import OAuthHandler
import config
import logging
LOGGER = logging.getLogger("twentiment")
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s |%(name)s| %(message)s',
filename='twentiment.log'
)
if __name__ == "__main__":
auth = OAuthHandler(config.C_KEY, config.C_SECRET)
auth.set_access_token(config.A_TOKEN, config.A_SECRET)
api = API(auth)
status_id = 789360573788131328
status = api.get_status(status_id)
blob = TextBlob(status.text)
print(blob.sentiment.polarity)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment