read_multipart(fileobj,
boundary=None)
|
|
Simple streaming MIME multipart parser.
This function takes a file-like object reading a MIME envelope, and yields
a (headers, is_multipart, payload) tuple for every part found, where
headers is a dictionary containing the MIME headers of that part (with
names lower-cased), is_multipart is a boolean indicating whether the
part is itself multipart, and payload is either a string (if
is_multipart is false), or an iterator over the nested parts.
Note that the iterator produced for nested multipart payloads MUST be fully
consumed, even if you wish to skip over the content.
- Parameters:
fileobj - a file-like object
boundary - the part boundary string, will generally be determined
automatically from the headers of the outermost multipart
envelope
- Returns:
- an iterator over the parts
|