Webserverpy

The webserver.py module takes the port number to start the web server as a command-line argument and starts the web server, displaying status activity messages to standard output. Table 4-1 shows the function of the webserver.py module. This function could have just been run as part of the main program, but by encapsulating it in a function it can now be imported and called if necessary from another program.

Running the Python Web Server

Before you run the Python web server, you'll need to determine what port you want to run it on. It needs to be a port that isn't being used by some other program. This chapter's example uses port 8006. You will want to run the Python web server from any server that you want to monitor for HTTP response performance. To run it, you just need to open a command prompt window and navigate to the Chapter 4 application directory and type python webserver.py 8006. Notice that you need to type the name...

Downloading the Win All Package

Python For Windows Extensions

Win32All requires that Python minimum version 2.2 already be installed on a Windows system. In a web browser, navigate to You will see the Python for Windows Extensions window shown in Figure B-14. Click the Download the Python for Windows Extensions link. Scroll down the page to the section that is shown in Figure B-15. Notice that downloads are available for versions of Python from 2.2 through 2.6. Click the appropriate link for the version of Python you have installed and you'll get a prompt...

Testing Internal Web Server Performance

If you type 2 at the main menu and press Enter to test internal web server performance, you'll get the following prompt WEB PERFORMANCE TESTER - INTERNAL WEBSERVER CHECK Enter the ip addresses of the web servers running the Python Webserver, seperated by spaces For example, if you had two servers running the Python web server and their IP addresses were 192.168.1.102 and 192.168.1.103, at the prompt you would type the following When I typed the preceding addresses and pressed Enter, the...

The winreg Module Manipulate the Windows Registry

The Windows Registry is a database that contains program and system information and settings. Often it can be useful to access the Registry to read from it or write to it via a script. The winreg module makes this easy to do in Python. The following example queries a particular key in the Registry and outputs all the subkeys for that key list values owned by this registry key name, value, type _winreg.EnumValue explorer, i print repr name , i 1 The following is the output for this program I...

The winsound Module

The winsound module enables a script to access the sound-playing functionality of Windows platforms. It includes functions and several built-in constants. The module enables a script to play Windows system sounds or WAV files. The following example shows how to play various sounds with the winsound module import winsound print Play Windows exit sound. winsound.SND_ALIAS print Probably play Windows default sound winsound.PlaySound , winsound.SND_ALIAS print Play a message beep...