mimetools.Message Methods -- Python library reference
Prev: mimetools
Up: mimetools
Top: Top
11.11.1. Additional Methods of Message objects
The mimetools.Message
class defines the following methods in
addition to the rfc822.Message
class:
- getplist () -- Method on mimetool.Message
-
Return the parameter list of the
Content-type
header. This is
a list if strings. For parameters of the form
`key=value', key is converted to lower case but
value is not. For example, if the message contains the header
`Content-type: text/html; spam=1; Spam=2; Spam' then
getplist()
will return the Python list ['spam=1',
'spam=2', 'Spam']
.
- getparam (name) -- Method on mimetool.Message
-
Return the value of the first parameter (as returned by
getplist()
of the form `name=value' for the
given name. If value is surrounded by quotes of the form
<...> or "...", these are removed.
- getencoding () -- Method on mimetool.Message
-
Return the encoding specified in the `Content-transfer-encoding'
message header. If no such header exists, return
"7bit"
. The
encoding is converted to lower case.
- gettype () -- Method on mimetool.Message
-
Return the message type (of the form `type/varsubtype')
as specified in the `Content-type' header. If no such header
exists, return
"text/plain"
. The type is converted to lower
case.
- getmaintype () -- Method on mimetool.Message
-
Return the main type as specified in the `Content-type' header.
If no such header exists, return
"text"
. The main type is
converted to lower case.
- getsubtype () -- Method on mimetool.Message
-
Return the subtype as specified in the `Content-type' header. If
no such header exists, return
"plain"
. The subtype is
converted to lower case.
Prev: mimetools
Up: mimetools
Top: Top