Twitter's RESTful API is quite simple, and I wrote an open source library for Twitter based on the sippycode HTTP library in a few minutes. Here's an example of posting a new update (tweeting):
import sippycode.http.core as http_coreIn the above, the client sends an authenticated POST to the updates URL. Using the
import sippycode.auth.core as auth_core
def __init__(self, username, password):
self._credentials = auth_core.BasicAuth(username,
def update(self, message):
request = http_core.HttpRequest(method='POST')
client = http_core.HttpClient()
response = client.request(request)
TwitterClientin your code looks like this:
client = TwitterClient('my-username', 'my-password')To try out this Twitter console app, unpack the download and run
client.update('Try out this Twitter client: http://oji.me/wP')
sippy_twitter.py. With it, you can update your status on Twitter or read the updates from your friends. When reading, the client displays five updates at a time, since showing more at once would likely cause some to scroll off the top of the screen (assuming the terminal displays twenty-five lines).
This simple application was designed to be a proof of concept, but it's really grown on me. Cycling through all of my friend's updates doesn't require any scrolling, and it feels snappier than the web interface. It seems like others are enjoying this terminal client too.
There are quite a few ways that this client could be improved, so there's plenty of opportunity to pitch in if you are interested. I have received feature requests from friends who previewed this app, such as: support command line arguments which will allow the client to perform updates when being run from another program, show a running countdown from 140 characters as you are typing your update (could probably be done using
ncurses), ability to follow users, and read updates from just one user. If you'd like to participate in any of these, let me know in the comments.
Fire up your terminal and give this client a try. Why not post an update to @jscud right now?