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).
poplib POP3 protocol client (requires sockets).
imaplib IMAP4 protocol client (requires sockets).
nntplib NNTP protocol client (requires sockets).
smtplib SMTP 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.
multiFile None
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.
mimetypes Mapping of filename extensions to MIME types.
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.
BaseHTTPServer Basic HTTP server (base class for SimpleHTTPServer and CGIHTTPServer).