Now that everything is working with the sample data, it's time to try getting real flight data to see if the same optimizations can be used. You'll be downloading data from Kayak, which provides an API for doing flight searches. The main difference between real flight data and the sample you've been working with is that in the real flight data, there are many more than nine flights per day between most major cities.
Kayak, shown in Figure 5-6, is a popular vertical search engine for travel. Although there are lots of travel sites online, Kayak is useful for this example because it has a nice XML API that can be used to perform real travel searches from within a Python program. To use the API, you'll need to sign up for a developer key by going to http://www.kayak.com/labs/api/search.
Figure 5-6. Screenshot of the Kayak travel search interface
The developer key is a long string of numbers and letters that you'll use to do flight searches in Kayak (it can also be used for hotel searches, but that won't be covered here). At the time of writing, there is not a specific Python API for Kayak like there is for del.icio.us, but the XML interface is very well explained. This chapter will show you how to create searches using the Python packages urllib2 and xml.dom.minidom, both of which are included with the standard Python distribution.