Created
November 10, 2016 00:02
-
-
Save bruno78/7ee8103cb9dedf318b224fa9dc878f10 to your computer and use it in GitHub Desktop.
A basic twitter api to print user statuses
This file contains 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
import sys | |
import operator | |
import requests | |
import json | |
import twitter | |
from config import * | |
# Interact with Twitter API | |
twitter_api = twitter.Api(consumer_key = twitter_consumer_key, consumer_secret = twitter_consumer_secret, | |
access_token_key = twitter_access_token, | |
access_token_secret = twitter_access_secret) | |
# This handles the user | |
handle = '@user' | |
# this will retrieve user status: screen name, number of twitters and whether include retweets | |
statuses = twitter_api.GetUserTimeline(screen_name=handle, count=10, include_rts=False) | |
for status in statuses: | |
if (status.lang == 'en'): | |
print status.text.encode('utf-8') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment