Skip to content

Instantly share code, notes, and snippets.

@chriszf
Created June 27, 2012 16:52
Show Gist options
  • Save chriszf/3005363 to your computer and use it in GitHub Desktop.
Save chriszf/3005363 to your computer and use it in GitHub Desktop.
Sample command line twitter client
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