Although many are outside our scope here, there are a variety of ways that Python programmers script the Web. Just as we did for GUIs, I want to begin with a quick overview of some of the more popular tools in this domain before we jump into the fundamentals.
As we’ll see in this chapter, Python comes with tools the
support basic networking, as well as implementation of custom
types of network servers. This includes
sockets, but also the select call for
asynchronous servers, as well as higher-order and pre-coded
socket server classes. Standard library
server support all these
As we’ll see in the next chapter, Python’s Internet arsenal also includes canned support for the client side of most standard Internet protocols—scripts can easily make use of FTP, email, HTTP, Telnet, and more. Especially when wedded to desktop GUIs of the sort we met in the preceding part of this book, these tools open the door to full-featured and highly responsive Web-aware applications.
Perhaps the simplest way to implement interactive website behavior, CGI scripting is an application model for running scripts on servers to process form data, take action based upon it, and produce reply pages. We’ll use it later in this part of the book. It’s supported by Python’s standard library directly, is the basis for much of what happens on the Web, and suffices for simpler ...