en lĂnea jainbasil
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
| Print article | This entry was posted by jainbasil on October 29, 2009 at 12:11 am, and is filed under Life, My Projects. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |

about 2 weeks ago
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.