Basically this means that when we do

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: it could seriously damage their labwork! If you are found to be disrupting someone else’s work in this way, the matter will be taken very seriously (and because this is done via a webserver, all accesses are being logged!) Before starting to write your chat client properly, take a quick look at the ‘’ module that we’ve provided. This file imports the same ‘urllib’ module that we used in the first lab exercise – this allows python to ‘speak http’. It then defines a class called ‘IMServer’ that you’ve already used from the python command line. The actual detail of the class is unimportant, and actually uses some fairly advanced python concepts that we don’t care about in this course. The only thing that matters here is that you can see the ‘urlopen’ instructions, which are simply reconstructing the same kind of ‘action=get&key=something’ type URLs that you have already manually entered earlier. In this module, we wrap up the untidy business of creating and calling the URL as a python ‘dictionary’ (see the notes from Examples Class 1 if you want to know more about this). Basically this means that when we do 3 In older versions of python this would have been ‘unset’ rather than ‘del’ server[’myKey’] = ’something’ this module will create and GET the URL y=myKey&value=something and similarly print server[’myKey’] will do the same as typing y=myKey Now that the infrastructure is in place, all that remains is to write the chat client! To keep things simple, we’ll mak...
View Full Document

This document was uploaded on 02/10/2014.

Ask a homework question - tutors are online