# 11 Internet and WWW Services

The modules described in this chapter provide various services to World-Wide Web (WWW) clients and/or services, and a few modules related to news and email. They are all implemented in Python. Some of these modules require the presence of the system-dependent module `sockets`, which is currently only fully supported on Unix and Windows NT. Here is an overview:

cgi
  -- Common Gateway Interface, used to interpret forms in server-side scripts.

urllib
  -- Open an arbitrary object given by URL (requires sockets).

httplib
  -- HTTP protocol client (requires sockets).

ftplib
  -- FTP protocol client (requires sockets).

gopherlib
  -- Gopher protocol client (requires sockets).

nntplib
  -- NNTP protocol client (requires sockets).

urlparse
  -- Parse a URL string into a tuple (addressing scheme identifier, network location, path, parameters, query string, fragment identifier).

sgmllib
  -- Only as much of an SGML parser as needed to parse HTML.

htmllib
  -- A parser for HTML documents.

xmllib
  -- A parser for XML documents.

formatter
  -- Generic output formatter and device interface.

rfc822
  -- Parse RFC-822 style mail headers.

mimetools
  -- Tools for parsing MIME style message bodies.

binhex
  -- Encode and decode files in binhex4 format.

uu
  -- Encode and decode files in uuencode format.

binascii
  -- Tools for converting between binary and various ascii-encoded binary representation

xdrlib
  -- The External Data Representation Standard as described in RFC 1014, written by Sun Microsystems, Inc. June 1987.

mailcap
  -- Mailcap file handling. See RFC 1524.

base64
  -- Encode/decode binary files using the MIME base64 encoding.

quopri
  -- Encode/decode binary files using the MIME quoted-printable encoding.

SocketServer
  -- A framework for network servers.

mailbox
  -- Read various mailbox formats.

mimify
  -- Mimification and unmimification of mail messages.

- 11.1 Standard Module `cgi`
  - 11.1.1 Introduction
  - 11.1.2 Using the cgi module
  - 11.1.3 Old classes
  - 11.1.4 Functions
  - 11.1.5 Caring about security
  - 11.1.6 Installing your CGI script on a Unix system
  - 11.1.7 Testing your CGI script
  - 11.1.8 Debugging CGI scripts
  - 11.1.9 Common problems and solutions
- 11.2 Standard Module `urllib`
- 11.3 Standard Module `httplib`
  - 11.3.1 HTTP Objects
  - 11.3.2 Example
- 11.4 Standard Module `ftplib`
  - 11.4.1 FTP Objects
- 11.5 Standard Module `gopherlib`
- 11.6 Standard Module `nntplib`
  - 11.6.1 NNTP Objects
- 11.7 Standard Module `urlparse`
- 11.8 Standard Module `sgmllib`
- 11.9 Standard Module `htmllib`
- 11.10 Standard Module `xmllib`
- 11.11 Standard Module `formatter`
  - 11.11.1 The Formatter Interface
  - 11.11.2 Formatter Implementations
  - 11.11.3 The Writer Interface
  - 11.11.4 Writer Implementations
- 11.12 Standard Module `rfc822`
  - 11.12.1 Message Objects
- 11.13 Standard Module `mimetools`
  - 11.13.1 Additional Methods of Message objects
- 11.14 Standard Module `binhex`
  - 11.14.1 notes
- 11.15 Standard Module `uu`
- 11.16 Built-in Module `binascii`
- 11.17 Standard Module `xdrlib`
  - 11.17.1 Packer Objects
  - 11.17.2 Unpacker Objects
  - 11.17.3 Exceptions
- 11.18 Standard Module `mailcap`
- 11.19 Standard Module `base64`
- 11.20 Standard Module `quopri`
- 11.21 Standard Module `SocketServer`
- 11.22 Standard Module `mailbox`
  - 11.22.1 Mailbox Objects
- 11.23 Standard Module `mimify`
- 11.24 Standard Module `BaseHTTPServer`