jainbasil en lĂnea
Posts tagged Python
Playing with python : A Command-line twitter client
Oct 29th
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

Recent Comments