Department of Computing

Local Navigation

COMP249 Web Technology

Practical - Week 7

The main task this week is to work on Assignment 2. However, here is a small task based on cookies that you might like to try as an exercise.

The aim of this task is to introduce you to the Python Cookie library and the use of cookies in CGI scripts. Before you start, please read section 11.19 Cookie - HTTP state management of the Python Library Reference. After that, run all of the examples in section "11.19.3 Example" that demonstrate how to use the cookie module.

Now you are well prepared to write a Python script that counts how many time a client visited a web site. The first time the client visits the site, the Python script should create a cookie with a counter and send the cookie back to the client with an HTML page that simply displays the current counter in the window of the browser. The next time the client connects to the site, the Python script should increase the counter and send the cookie with the new value back to the browser, and so on.

Comments to: comp249-admin@ics.mq.edu.au

Copyright & Site information