My election party tomorrow will feature DMX controlled RGB LED lighting. The color of the house should reflect the electoral balance. The color will start purple, and drift toward either red or blue, depending on whoâ€™s winning…
In order to do this, it was necessary to obtain live election results. Presented for your use is a simple python urllib2 scraper which will fetch live results from CNN.com. Return value is ((dpopular, delectoral), (rpopular, relectoral)). Furthermore, when CNN calls the race, the get method throws an ElectionWon exception. This code is in the public domain. The data, however, actually costs around $4000 if you buy it directly from exit-poll.net, the clearinghouse for aggregated exit poll data. Yikes!
Code to scape CNN.com election results