Harry Tormey

October 4, 2009

JqueryTwitter: A simple Twitter Pylons example using Jquery and python-twitter

Being able to write applications for facebook is nice but if you really want to be all hip and buzzword 2.0 compliant you need to be able to add ajax and Twitter to your repertoire. With this in mind I decided to put together a simple little demo which uses Jquery/python-twitter to scrape, search and update a list from the twitter public time line in “real time” every time you type a letter in a text box. You can grab the source here.

In times of yore developing any web application involving Javascript meant wading through a sewer of browser incompatabilites and crafting inelegant hacks to deal with the fact that the majority of people surf the web using old non standards compliant web browsers (i.e internet explorer 6). To add insult to injury the tools available for developing Javascript back in those ancient times totally sucked.

Fast forward to 2009 and we have awesome debugging tools like firebug and webkit inspector which make web development a somewhat more manigable proposition. Apart from nicer debugging tools the Javascript scene has been flooded with a wave of sweet libraries (mochikit, yui, Jquery, etc) all designed to abstract away common tasks and annoyances (browser incompatabilities I’m looking at you). Add to all of this the recent focus by brower makers on Javascript performance (v8, JavaScriptCore, etc) and you will find that developing Javascript today is incomparably nicer than in the bad old days.

Most of the secret ajax sauce that powers this example can be found in demo/public/search.js. My library of choice for this project is Jquery, which I picked due to the fact that there has been a ton of plugins written for it, it’s been around since 2006 and is very straight forward to use.

The application comes bundled with Jquery and python-twitter. It assumes a basic familiarity with both Javascript/Jquery, that you have read chapter two and three of the excellent freely available pylons book and or that you know your way around Pylons. Unlike my facebook example this demo should serve straight out of the box (after you serve up development.ini with paster visit http://127.0.0.1:5330/search/index). Enjoy.

Powered by WordPress