This course has finished, please see the 2012 Internet Programming in Python Syllabus

UW Certificate Program in Python Programming

Internet Programming in Python

Winter Term, 2011 - (10 Sessions) Tuesdays 6 - 9 pm, January 11 through March 15

This program also includes Programmming in Python (Autumn 2010) and System Development with Python (Spring 2011).

Summary. Readings. Schedule.

Course objectives: This course emphasizes distributed programs and web applications - how they work and how to program them in Python. Students will explore the underlying principles and their expression in Python libraries. Students will learn contrasting approaches in creating applications: programming with the low-level libraries versus using highly integrated frameworks. All topics will be presented with a focus on solving real problems with simple, pragmatic code.

Prerequisites: Students should have successfully completed Programmming in Python or have an equivalent level of experience. Contact the instructor prior to registering if not in the certificate program.

Textbooks: Various online sources will be used.

Instructor: Brian Dorsey.
Brian Dorsey is a database and Python developer with over 10 years of experience using Python professionally. He currently works at Vulcan Inc., developing command line tools, simple web applications, Windows services, HTTP/JSON APIs and the occasional iPhone prototype. He is excited about information, databases, user experience, testing and glue code. Brian is a co-organizer of the Seattle Python Interest Group ( and has given several talks and tutorials at conferences and user groups.

Technology Requirements: Students must have access to a computer for their assignments and projects, where they can install software (the course does not provide a computer laboratory). It is recommended that students have a portable computer to bring to class. Internet access will be provided at classes.

Assessment criteria: The course is graded Pass/Fail, based on satisfactory completion of required programming assignments and classroom presentations. Attendance is required; more than two unexcused absences will result in a Fail.

Disability accommodation: The University of Washington is committed to providing access and reasonable accommodation in its services, programs, activities, education and employment for individuals with disabilities. For information or to request disability accommodation contact: Disability Services Office: 206.543.6450/V, 206.543.6452/TTY, 206.685.7264 (FAX), or e-mail at

Assignments may be completed in groups of 1-3 people. Students are encouraged to actively consult each other and share any relevant reference and support material. However, all code submitted for assignments must be completely written by each group.


See the Schedule below for specific readings each week.


Python 2.6 Quick Reference (awesomely dense and complete)
Python 2.6.5 documentation (official documentation from
Python Standard Library - Internet Protocols and Support
Python Module of the Week - examples of using the modules in the standard library.


Tuesdays 6 - 9 pm, January 11 through March 15 (10 sessions).

Topics and readings will be revised before the course begins, consult frequently.

In addition to the topics listed below, each week will include:

1Jan 11 Introductions
Networking basics - How computers talk to each other (on the internet).
(tcp/ip, sockets, telnet, SMTP)

lecture slides
Twilio lightning talk
example scripts from the labs

assignment url:

WP - Internet Protocol Suite
Kessler - TCP/IP (sections 1, 2)
WP - Domain Name System
WP - Internet Socket
RFC 5321 - SMTP - (Appendix D ONLY)
(note: S is a server message, C is a client message.)

(skim before class, needed for labs & assignments)
python lib - socket
Socket Programming HOWTO
python lib - smtplib

WP - Berkeley socket interface
RFC 821 - SMTP (initial)
RFC 5321 - SMTP (latest)

ZeroMQ Guide - Chapter 1
2Jan 18 More protocols - Languages of the internet.
(POP3/IMAP, FTP, HTTP, others)

Guest Speaker: Brian, wearing a different hat.
Topic: 30 minute web server

Lightning talks: Joe, Jon P, Aaron F

lecture slides
example scripts from the labs

assignment url:
Read through this list of modules. If you don't know what
a protocol is for, look it up online. Think about their
relationship to each other, which are clients? Which are servers?
Which clients talk to which servers?
Python Standard Library Internet Protocols

An introduction to the HTTP protocol:
HTTP Made Really Easy

(skim before class, needed for labs & assignments)

httplib2 - A comprehensive HTTP client library that
supports many features left out of other HTTP libraries.

Skim these four documents from different phases
of HTTP's life. Get a feel for how the specification
has changed (and how it hasn't!).
HTTP - as defined in 1992
Hypertext Transfer Protocol -- HTTP/1.0
Hypertext Transfer Protocol -- HTTP/1.1
3Jan 25 Mashups and web APIs - Gluing things together and data for free.
(HTML/JavaScript, webscraping, REST, HTTP/JSON, XML-RPC)

Guest Speaker: John Musser (ProgrammableWeb)

Lightning talks: Jacob, Jeff B, Daniel

lecture slides
example scripts from the labs

assignment url:
Wikipedia's take on 'Web Services'
xmlrpc overview
xmlrpc spec (short)
json overview and spec (short)
How I Explained REST to My Wife (Tomayko 2004)
A Brief Introduction to REST (Tilkov 2007)

(skim before class)

python standard libraries:

external libraries:
BeautifulSoup - "You didn't write that awful page.
You're just trying to get some data out of it. Right now,
you don't really care what HTML is supposed to look like.
Neither does this parser."
httplib2 - A comprehensive HTTP client library that supports
many features left out of other HTTP libraries.
restkit - an HTTP resource kit for Python. It allows you
to easily access to HTTP resource and build objects around it.

rpclib - a simple, easily extendible soap library that provides
several useful tools for creating, publishing and consuming soap
web services
Suds - a lightweight SOAP python client for consuming Web Services.
the SOAP specification

Wikipedia on REST
Original REST disertation

4Feb 1 Live on the internet - letting other people run your code.
(hosting options, virtual machines, copying files,
git, a bit of unix, and just enough Apache configuration)

Lightning talks: Peter, Gregory

lecture slides
example scripts from the labs

assignment url:
Learning the Shell - An excellent overview of fundamental shell usage.
Read this while logged into a bash shell (either local or
on your VM) and experiment with anything new to you.

bonus philosophy (awesome, but not required):
In the Begining was the Command Line (annotated version)
This is long, a bit historical, and thought provoking.
5Feb 8 Low level web - Write a dynamic web site the hard way.
(HTTP again, request/response, CGI, mod_python, WSGI)

Lightning talks: Jesse, Andrew, Tim

lecture slides
example scripts from the labs

assignment url:
CGI tutorial - Read the following sections:
Hello World, Debugging, Form. Other sections optional.
Follow along, hosting CGI scripts either via Apache on our
VMs, or locally using CGIHTTPServer.

WSGI tutorial - Follow along, hosting WSGI scripts either via
Apache on our VMs, or locally using wsgiref.

Prepare for class:
CGI example scripts - Use these examples to get started
experimenting with CGI.

CGI module - utilities for CGI scripts, mostly
form and query string parsing
Parse URLS into components
CGIHTTPServer - python -m CGIHTTPServer
WSGI Utilities and Reference implementation
WSGI 1.0 specification
WSGI 1.0.1 (Python 3 support)
test WSGI server, like cgi.test()

Alternate WSGI introductions:
Getting Started with WSGI - by Armin Ronacher
very minimal introduction to WSGI
6Feb 15 Small web frameworks - Writing focused web sites.
(overview of frameworks and dive into CherryPy)

Guest Speaker: Leo Parker Dirac (Blog)
Topic: Pushing the limits of the HTTP protocol

Lightning talks: Jeff S, Melissa, Patrick

lecture slides
example scripts from the labs

assignment url:
CherryPy Tutorial

run this in your VM:
sudo apt-get install python-cherrypy3
svn co

prepare for class:
tutorial scripts - more detailed example scripts
Work through as many of these as you can before class.
(The svn command above will copy the files to a tutorial directory.)
We will be working with the current version: 3.1.2

CherryPy official documentation
slightly crazy screencast - building a CherryPy application interactively

7Feb 22 Large web frameworks 1 of 2 - Standing on the shoulders of giants.
(overview of frameworks and dive into Django)

Guest speaker: Gary Bernhardt (Blog)

Lightning talks: Sun Hee, Ted

lecture slides
example scripts from the labs

assignment url:
We will be using Django 1.2.5 (current stable)

Django at a glance
Django tutorial
  • work through django tutorial parts 1, 2 and 3 on your local development machine
  • use the Django development server, not anything more complicated
    python runserver
  • don't configure a database, use the default: sqlite
# local install
tar xvfz Django-1.2.5.tar.gz    (or use 7zip on Windows)
cd Django-1.2.5/
python install
>>> import django
>>> django.get_version()
If you want to also install it on our VMs,
Django 1.2.5 is *not* available via apt-get
in Ubuntu 10.4 on our VMs.
# VM install:
$ wget
$ tar xvfz Django-1.2.5.tar.gz
$ cd Django-1.2.5/
$ sudo python install
$ python
>>> import django
>>> django.get_version()
Django documentation

"The following parable will take you on a journey
through the creation of a Git-like system from the ground up.
Understanding the concepts presented here will be the most
valuable thing you can do to prepare yourself to harness
the full power of Git": The Git Parable
8Mar 1 Large web frameworks 2 of 2 - Standing on the shoulders of giants.
(more Django)

Guest Speaker: Ted Leung (Blog)

Lightning talks: Aaron B, Derek, Jon C

lecture slides
example scripts from the labs

assignment url:
(PDF) Building Django - Jacob Kaplan-Moss (2009)
(PDF) Django in the real world (2009)
    video instead? - part 1 part 2 part 3
read a bit about each of the apps in this post:
What's your favorite Django app?


A couple of good looking books:
Django 1.1 Testing and Debugging
Beginning Django E-Commerce

The real difference between fetch and pull:
"Don't use git pull, use git fetch and then git merge."
git: fetch and merge, don't pull - Mark Longair

"You can learn a whole lot about Unix from that one little command."
The Tar Pipe - Gary Bernhardt
9Mar 8 Databases - relational and otherwise.
(a tour of information storage methods)

Guest Speaker: Dave Peck (Blog)
Topic: Google App Engine and Amazon Web Services

Lightning talks: Ben, Delane, Hitoshi
(Wikipedia) Relational Database
(Wikipeia) SQL
Is the relational database doomed?
NOSQL at Netflix
I can't wait for NOSQL to die
NOSQL is software darwinism
Why NOSQL will not die
NOSQL Comparison

Redis Tutorial by Simon Willison
10Mar 15 Python in the Cloud - Let someone else run your servers.
(overview of the options and dive into Google App Engine)

Guest Speaker: Brian Dorsey :)
Topic: PyCon 2011 - experiences and hot topics.
Amazon Web Services
Overview pages:
Amazon Elastic Compute Cloud (Amazon EC2)
Amazon Elastic Block Store (EBS)
Amazon Simple Storage Service (Amazon S3)
Amazon SimpleDB
Amazon Relational Database Service (Amazon RDS)

Google App Engine
What Is Google App Engine?
App Engine Python Overview

App Engine Python Runtime Environment docs
Datastore Overview
Book: Programming Google App Engine
(There don't appear to be any recent books,
you'll have to rely on the Google docs for new features.)

"Use your friends. Keep it simple. Play."
Teach Yourself Programming in Ten Years

Thank you very much to Blue Box Group, they have generously donated a Virtual Private Server for each of the students.