Home > Articles > Open Source > Python

Python Libraries

Internet Data Handling

This group covers modules that support encoding and decoding of data handling formats and that are largely used in Internet applications.

For more details and examples about using these modules, see Chapter 13, "Data Manipulation."

sgmllib

The sgmllib module is an SGML (Standard Generalized Markup Language) parser subset. Although it has a simple implementation, it is powerful enough to build the HTML parser.

htmllib

The htmllib module defines a parser for text files formatted in HTML (Hypertext Markup Language).

htmlentitydefs

The htmlentitydefs module is a dictionary that contains all the definitions for the general entities defined by HTML 2.0.

xmllib

The xmllib module defines a parser for text files formatted in XML (Extensible Markup Language).

formatter

The formatter module is used for generic output formatting by the HTMLParser class of the htmllib module.

rfc822

The rfc822 module parses mail headers that are defined by the Internet standard RFC 822. The headers of this form are used in a number of contexts including mail handling and in the HTTP protocol.

mimetools

The mimetools module provides utility tools for parsing and manipulation of MIME multipart and encoded messages.

TIP

MIME (multipurpose Internet mail extensions) is a standard for sending multipart multimedia data through Internet mail.

MimeWrite

The MimeWrite module implements a generic file-writing class that is used to create MIME-encoded multipart files.

multifile

The multifile module enables you to treat distinct parts of a text file as file-like input objects. Usually, this module uses text files that are found in MIME encoded messages.

binhex

The binhex module encodes and decodes files in binhex4 format. This format is commonly used to represent files on Macintosh systems.

uu

The uu module encodes and decodes files in uuencode format. This module does its job by transferring binary data over an ASCII-only connection.

binascii

The binascii module implements methods to convert data between binary and various ASCII-encoded binary representations.

base64

The base64 module performs base64 encoding and decoding of arbitrary binary strings into text strings that can be safely emailed or posted. This module is commonly used to encode binary data in mail attachments.

xdrlib

The xdrlib module is used extensively in applications involving Remote Procedure Calls (RPC). Similarly, it is often used as a portable way to encode binary data for use in networked applications. This module is able to encode and decode XDR data because it supports the external data representation (XDR) Standard.

mailcap

The mailcap module is used to read mailcap files and to configure how MIME-aware applications react to files with different MIME types.

NOTE

mailcap files are used to inform mail readers and Web browsers how to process files with different MIME types.

mimetypes

The mimetypes module supports conversions between a filename or URL and the MIME type associated with the filename extension.

Essentially, it is used to guess the MIME type associated with a file, based on its extension, as shown in Table 3.1.

Table 3.1 Some MIME Type Examples

Filename Extension

MIME Type Associated

.html

text/html

.rdf

application/xml

.gif

image/gif


quopri

The quopri module performs encoding and decoding of MIME quoted printable data. This format is primarily used to encode text files.

mailbox

The mailbox module implements classes that allow easy and uniform access to read various mailbox formats in a UNIX system.

mhlib

The mhlib module provides a Python interface to access MH folders and their contents.

mimify

The mimify module has functions to convert and process simple and multipart mail messages to/from the MIME format.

netrc

The netrc module parses, processes, and encapsulates the .netrc configuration file format used by the UNIX FTP program and other FTP clients.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.