Created
October 30, 2016 07:24
-
-
Save grafuls/7d7c73a7ede3c7e29d0b6c37370a2861 to your computer and use it in GitHub Desktop.
Tweeter sentiment analysis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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