Last active
August 29, 2015 14:13
-
-
Save matbor/eab3dc6a5f357496237a to your computer and use it in GitHub Desktop.
Just playing with the cursor method for tweep / twitter api
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
# uses tweepys/twitter api, using the cursor method here | |
# http://tweepy.readthedocs.org/en/latest/cursor_tutorial.html | |
import tweepy # pip install tweepy | |
# Consumer keys and access tokens, used for OAuth | |
consumer_key = '' | |
consumer_secret = '' | |
access_token = '' | |
access_token_secret = '' | |
# OAuth process, using the keys and tokens | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
auth.set_access_token(access_token, access_token_secret) | |
api = tweepy.API(auth) | |
for status in tweepy.Cursor(api.user_timeline, id = '3aw693').items(10): #show last 10 items of @3aw693 | |
#for status in tweepy.Cursor(api.user_timeline, id = '55432787', since_id = 556950228775874560).items(): #show all tweets for @3aw693 after tweet #id | |
print("@%s -- %s (%s)" % (status.author.screen_name, status.text, status.id)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment