jainbasil.net

personal website of jain basil aliyas

Playing with python : A Command-line twitter client

Just for a change, I am now playing with Python Programming Language, and the first thing which I did was a tiny twitter client which will run from our console. I have no plans to explain what I did on this, rather I am just adding a small code. This code uses a twitter module, a package named python-twitter will install it in Fedora. Here is the link to the Google code repository of python-twitter project.

This module contain many methods like PostUpdates, PostDirectMessage and more. See the documentation here to know more about the methods.

And finally, the code is :

#!/usr/bin/python

import twitter

username = “”
password = “”

api=twitter.Api(username=username,password=password)
statuses = api.GetFriendsTimeline(username)

for s in statuses:
print s.user.name.encode(“utf-8″),”(“,s.user.screen_name,”):”
print s.text.encode(“utf-8″)
print

Now, add your username and password, and on running the code, you will get your updates on the Command line. I didn’t get much time to experiment with this module, hence now it shows only updates. Those interested may try other methods in twitter module!

Jain


Tagged as , + Categorized as Life, My Projects

1 Comments

  1. i always update my Twitter and i love to twitter my daily activities to my friends and loved ones. i also maintain a personal blog for entries which requires more detail.

Leave a Reply