There has been some commotion over the past few days regarding Congresstional Web use restrictions. The rules are inadequate for the current state of the Web and must be rewritten to reflect changes in technology. Republicans and Democrats have been going back-and-forth over proposed changes to the existing rules; one side claiming the other is trying to stifle their communication. While they keep on bickering, we wanted to raise awareness of these Web use restrictions and get people involved.
We decided to launch a petition-like site that uses Twitter as the organizing method; using one of the very technologies that are impacted by Congressional Web use restrictions. We knew this had to be timely to have an impact, so the decision was made to have the Web site completed by the end of the day. That gave Kerry Mitchell, our fearless Creative Director, and I about six hours to get the site completed.
So how did it go?
As LOCT is a petition-like site, it is important to get a list of the people that are following the LOCT Twitter account. Twitter has a very nice API that makes it easy to pull information from the service. To get JSON list of people following your Twitter account, just send an HTTP GET request to
http://twitter.com/statuses/followers.json using HTTP Basic Authentication with your username and password. You can also get a list of people following other user accounts from
http://twitter.com/statuses/followers/<username>.json; no authentication necessary. We query Twitter for this information and cache it locally in a database.
Unfortunately, due to Twitter’s recent performance issues, many of the nicest features have either been limited or disabled, making it almost impossible to use Twitter exclusively for LOCT. We needed to get a list of tweets that mentioned LOCT, but couldn’t with the current performance restrictions in place. If only there was another service that provided this functionality.
And there is!
Summize rocks. Based right here in the greater Washington metropolitan area, Summize is tweet search service that has one of the few direct feeds into every tweet that is twittered. They also have an awesome API that makes it dead simple to search all tweets.
http://summize.com/search.json?q=%23loct08. That is all you need to get search results in JSON. Just like the list of followers from Twitter, the results are cached locally for Maximum PerformanceTM.
I would follow Django if it had a Twitter account
As with almost all projects created by Sunlight Labs, Let Our Congress Tweet is writting using Django, a Python Web development framework. I love Django. It simplifies development by providing object-relational mapping, templating, and other features in an unobtrusive way.
Developing in Django is already quite rapid, but by reusing existing code we can develop at an unheard-of pace. Writing a reusable Django application is quite easy as it is nothing more than a standard Python module that can be used in any project.
Feedinating the countryside
A few weeks ago we released a new version of the Sunlight Foundation Web site. The old, infuriating Drupal installation was replaced with a slick Django application that was written in-house. One of the main features of the new site is feed aggregator that pulls in the recent blog posts from across the Sunlight-influenced transparency network. To accomplish this, we wrote Feedinator, a Django feed aggregator application that makes it easy to pull in feeds from multiple blogs and display them in different ways on a Web site.
We use Feedinator on Let Our Congress Tweet to pull in the feed of Tweets from the LOTC08 twitter account and a del.icio.us feed of Web sites that have mentioned LOCT. By writing Feedinator in a way that makes it easily reusable, we were able to start incorporating feeds into LOCT in a matter of minutes.
If you would like to use Feedinator in your own project, you are in luck. We plan on releasing the code in the near future as well as the code for a few other Django applications and Python modules.
Designers are useful
While I was coding, Kerry took care of the design, CSS, and HTML. A few minutes of converting the HTML into Django templates and the site was up and running.
So that’s it! After throwing in a few cron entries and some Apache configuration files, the site went live. We went from an idea to a production ready Web site in about six hours. Sure, the it isn’t overly complicated, but we’re proud of it nonetheless.