Announcements | Summary | Readings | Software | Schedule

Internet Programming in Python

Winter Term, 2012
(10 Sessions) Tuesdays 6 - 9 pm, January 3 through March 13, downtown Seattle.

UW Certificate Program in Python Programming, also includes Programmming in Python (Fall 2011) and System Development with Python (Spring 2012).

This program will be similar to last year: Autumn 2010, Winter 2011, Spring 2011.


Announcements and updates:

The schedule is updated every week, consult frequently (refresh your browser).

Mar 9: Added more readings on hosting and cloud computing for week 10
Mar 9: The Django bookshop sample with users and logins is now working;
  these lecture notes have been updated with a detailed explanation.
Mar 2: Added some readings ( etc.) for week 10
Mar 2: Added more readings for week 9: HTTP cookie uses and implementation, Flask sessions
Mar 2: For week 9, recommend reading about Django sessions before authentication
Feb 29: Code samples for week 8 are now at GitHub
Feb 29: The Django Tutorial reading assignment has four parts: 1, 2, 3, 4
Feb 24: Week 10 class will be held Tues Mar 13 (make-up for snow day)
Feb 16: Corrected Apache configuration how-to.
Feb 1: Revised thirty_minute_webserver.py to accept connections from other hosts.
Jan 20: Added topics and readings through Feb 7 in the schedule
Jan 18: Please read this discussion of the recho lab exercise.
Jan 17: Class CANCELLED tonight due to weather
Jan 6: Students' work can be viewed at their GitHub pages and runs on these servers.
  If you don't see yours, email them to me.
Dec 30: First class is Tues Jan 3, 6 pm -- don't miss it!
  We will assign a virtual machine to each student and help students get set up at GitHub
  Your page should resemble this sample: https://github.com/uw-student/uw_python
Dec 23: This course page moved to: http://jon-jacky.github.com/uw_python/winter_2012/
  its github repository is: https://github.com/jon-jacky/uw_python/tree/gh-pages/winter_2012
Dec 11: Post this page with week 1 reading assignment.


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: There is no textbook. Various online sources will be used, see readings and schedule.

Instructor: Jonathan Jacky. See Fall term page.

Technology Requirements, Assessment criteria, Disability accommodation: See Fall term page.


Assigned readings

See the Schedule below for specific readings each week.

Reference

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

Supplementary readings

Brian Dorsey's weekly readings from last year, Winter 2011
Miscellaneous links on Internet technology, history, and milieu


Software

Python: Students will need Python installed on their computers. See Fall term page.

Git: Students will need the Git distributed version control system installed on their computers and will need to set up an account at GitHub. Here are directions for Windows, Mac, and Linux. When you are done your page should resemble this sample: https://github.com/uw-student/uw_python

ssh, scp: Students will need ssh (secure shell) and scp (secure copy) installed on their computers to communicate with remote Linux hosts. These come already installed on Mac and Linux. For Windows, they are included in putty.


Schedule and assigments

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

Additional topics and readings will be added, consult frequently (refresh your browser).

More readings are linked to Brian Dorsey's page from last year, Winter 2011.

Students' work can be viewed at their GitHub pages and runs on these servers.

Week Date Topics Readings
1Jan 3 Tools
Distributed version control, GitHub
Linux, virtual machines, BlueBox

Lecture notes: intro.txt, workflow.txt, directories.txt vm.txt

Code: echo_server.py, echo_client.py

Exercise: assignment.txt, directions.txt

Files are also in GitHub under week01

Students' GitHub pages and servers: students.html.
Installing Git on Windows, Mac, and Linux. More help from GitHub.
Git command summary (front, back), ingenious graphic summary. Miscellaneous Git links.

Learning the Linux command line.
Linux virtual machines hosted at Blue Box Group.
2Jan 10 Internet fundamentals
Packet switching, protocols, layers, and APIs
Sockets

Lecture notes: week02.txt, internet.txt, services.txt

Lab exercises: lab02.txt (recho)

Solutions: echo_client.py, also recho_client.py, recho_server.py

Discussion: lab02_discussion.txt

Optional lab: lab02A.txt (socket buffers)

Code: echo_server_select.py

Assigment: assign02.txt (chat)

Files are also in GitHub under week02
Readings:
WP - Internet Protocol Suite
Socket Programming HOWTO
Echo Server with Select (handling multiple sockets)

Reference:
Python Standard Library Internet Protocols
Standard TCP and UDP port numbers
python lib - socket
python lib - select

Coming soon (PyCon 2012, March 9):
Through the Ether And Back Again

 Jan 17 Cancelled, weather  
3Jan 24 Network service internals
Sockets, Select

Lecture notes: week03.txt, recho.txt, select.txt

Code: recho_client.py, recho_server.py
echo_server_select.py

Labs: experiment with the code (above), work on the assignments: lab_recho.txt

Continuing assignment: assign02.txt (chat)

New assignment: web_developer.txt

Files are also in GitHub under week03
All of the above, but especially:
Echo Server with Select (handling multiple sockets)
python lib - select

For the web developer assignment
(choose the one for your browser):
Firefox: Firebug Net Panel
Chrome: Developer Tools
Safari: Web Developer Tools
IE8, IE9: Developer Tools

4Jan 31 Web fundamentals
HTTP and HTML
Web servers

Assignment solution: chat_server.py
chat_client.py

Lecture: week04.txt, http_notes.txt

Code: hello_www.py, thirty_minute_webserver.py, print_time.py

Lab: http.txt, echo_www.txt

Assignment: thirty_minute_webserver.txt

Files are also in GitHub under week04
Readings:
HN - Web Fundamentals (very short post by halo)
HTTP Made Really Easy
HTML Basics
ThirtyMinuteWebServer

Reference:
HTTP/1.1 (more here)
WP - URL
HTML Tags
python lib - SimpleHTTPServer
curl command-line HTTP utility
Developer tools for your browser (above)

5Feb 7 Web clients
Downloading web pages
Screen scraping: processing HTML
Data formats: XML, JSON
Web APIs: URL queries, RPC, REST

Assignment solution: echo_www.py, ws30.py

Lecture: week05.txt, review05.txt, scrape_notes.txt, web_api.txt

Code: scrape.py, soup.py, json_time.py, github_api.py
freebase_popper.py

Lab: scrape.txt

Assignment: webclient.txt

Files are also in GitHub under week05
Readings:
HOWTO Fetch Internet Resources Using urllib2
requests Quickstart (urllib2 alternative)
Beautiful Soup Quick Start
JSON: The Fat-Free Alternative to XML
A Brief Introduction to REST
Freebase, its API, in Python

Reference:
python lib - urllib2
requests (urllib2 alternative)
python lib - HTMLParser
BeautifulSoup (parses broken HTML)
lxml (includes BeautifulSoup and much more)
python lib - json
simplejson (json alternative)

Web API zoo (see also Freebase above):
GitHub, its APIs, in Python (and others)
Wordnik, its APIs, in Python
Flickr, its APIs, in Python
Twitter, its APIs, in Python
Google APIs and Developer Products
  for example Google Maps Image APIs etc.
How To Make Your Own Web Mashup
  scroll down for many APIs and tutorials
6Feb 14 Web applications from scratch
Web servers vs. web applications
System and server administration
HTML forms, HTTP GET vs. POST, URL queries
Environment variables, CGI, and WSGI

Assignment solution: download.py

Lecture: week06.txt, review06.txt, servers.txt, layers.txt

Code: cgi_test.py, echo_cgi.html, echo_cgi.py, wsgi_simple_server.py, wsgi_test.py, echo_wsgi.py, test.wsgi

Lab: cgi_lab.txt, apache_howto.txt

Assignment: wsgi_assignment.txt

Files are also in GitHub under week06
Readings:
HOWTO Use Python in the web
Unix guide, more, tools, SSH (browse as needed)
CGI tutorial (read Hello World, Debugging, Form)
Getting Started with WSGI

Reference: CGI, WSGI
WP - CGI
WSGI 1.0.1
python lib - urlparse
python lib - CGI
python lib - WSGI
python lib - CGIHTTPServer
Werkzeug WSGI utilities

Reference: VMs, Linux, Apache
Blue Box Group VPS (our VMs)
Linux command line
Ubuntu Server (Linux on our VMs)
Apache HTTP Server
nginx (Apache alternative)
Twisted.Web, also here (web server in Python)

7Feb 21 Web microframeworks
Flask
MVC architecture
URL routing, templates, testing

Assignment solution: echo_wsgi.py

Lecture: week07.txt, frameworks.txt, mvc.txt

Code: echo_flask.py, echo_flask/ and contents

Lab: flask_lab.txt

Assignment: books.txt, bookdb.py, bookdb_test.py

Files are also in GitHub under week07
Readings:
HN - Web app design advice
Flask Quickstart

Reference:
Python Web Frameworks (annotated catalog)

8Feb 28 Complex web frameworks I
Django
Databases and ORM

Lecture: week08.txt, django.txt

Assignment: books_django.txt

Code samples are at GitHub
Readings:
Django at a glance
Django Tutorial 1, 2, 3, 4

Review on databases:
Week 10 from Fall (scroll down)

References on databases in Django:
Models and databases
FAQ: Databases and models
Providing initial data for models
Creating forms from models
Integrating Django with a legacy database
"Do I have to use your model/database layer?"
Databrowse

Browse these to see what is possible:
Django book
Django documentation
Django FAQ
How-to guides
django-admin.py and manage.py

Background, motivation, alternatives:
Why does this project exist?
Design philosophies
single-file Django app, also here and here
djing microframework from Django co-author

Using Jinja With Django (Flask template library)

9Mar 6 Complex web frameworks II
Django again
Sessions, authentication, cookies
Testing and debugging

Lecture: week09.txt, sessions.txt. testing.txt

Assignment: books_django_2.txt

Code samples are at GitHub
Readings:
WP: HTTP cookie: uses and implementation
Flask: sessions
Django: How to use sessions

References on sessions and authentication:
Django Book: Sessions, Users, and Registration
User authentication in Django

References on testing:
python lib - doctest
python lib - unittest
Testing Flask Applications
Testing Django applications
Debugging Django

10Mar 13 Python in the cloud
Hosting services, Amazon AWS, Google App Engine, ...

PyCon 2012 report

Lecture: week10.txt, logins.txt hosting.txt

Code samples are at GitHub
(same location as last week, but revised)

Readings:
Five Stages of Hosting (also here and here)
by Maceij Ceglow (also here)
  Comments from Hacker News

Reference:
Google App Engine, Python overview
Heroku quickstart, Python on Heroku/Cedar
PiCloud platform, documentation
Amazon Web Services AWS, EC2, S3
Blue Box Group VPS, Virtual Private Servers
WebFaction shared hosting, dedicated servers

Advice on tech, business from Hacker News:
Ask YC Archive (on AWS and other hosting)
Ask HN Archive (on hosting)

PyCon 2012:
Program with links to authors' summaries
Notes made at the talks
Slides from the talks
Video streams live
Video talks PyCon 2012
Video archive PyCons etc. 2009 - 2012

Announcements | Summary | Readings | Software | Schedule

Jonathan Jacky, jon at u dot washington dot edu