The little twitter client I use :)

Here's a small python script to update and read tweets from different timelines. You can use it with head/tail commands to customize the output. Actually, I wrote this script just for personal use and now I would like to share it with you :) Thanks to tweepy python module, make sure it's installed before trying the script :)

#!/usr/bin/env python
# Copyright 2011 Ershad K <ershad92@[nospam]gmail.com>
# Licensed under GPL Version 3

import sys
import tweepy

CONSUMER_KEY = ' Fill here'
CONSUMER_SECRET = ' File here too'
ACCESS_KEY = ' Type yours here'
ACCESS_SECRET = 'Type yours here too'

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)

if sys.argv[1] == 'u':
    api.update_status(sys.argv[2])

elif sys.argv[1] == 'p':
    public_tweets = api.public_timeline()
    for tweet in public_tweets:
        print tweet.user.screen_name,":",tweet.text
        print ""

elif sys.argv[1] == 'r':
    mention_tweets = api.mentions()
    for mtweet in mention_tweets:
        print mtweet.user.screen_name,":",mtweet.text
        print ""

elif sys.argv[1] == 'h':
    friends_tweets = api.home_timeline()
    for ftweet in friends_tweets:
        print ftweet.user.screen_name,":", ftweet.text
        print ""

Hope you like it :)

Leave a Comment