Created
June 27, 2012 16:52
-
-
Save chriszf/3005363 to your computer and use it in GitHub Desktop.
Sample command line twitter client
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 tweepy | |
import sys | |
while True: | |
line = raw_input("> ") | |
tokens = line.split() | |
if not tokens: | |
continue | |
command = tokens[0] | |
if command == "public": | |
public_tweets = tweepy.api.public_timeline() | |
for t in public_tweets: | |
print t.text | |
elif command == "trends": | |
print "GET YOUR OWN TRENDS" | |
# Get trends, print them out | |
elif command == "user": | |
username = tokens[1] | |
print tweepy.api.get_user(username) | |
elif command == "q": | |
sys.exit() | |
else: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment