12.3.1 Additional Methods of Message Objects
Python Library Reference
Previous: 12.3 mimetools
Up: 12.3 mimetools
Next: 12.4 MimeWriter
12.3.1 Additional Methods of Message Objects
The Message class defines the following methods in
addition to the rfc822.Message methods:
getplist ()
Return the parameter list of the content-type header. This is
a list of 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)
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 ()
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 ()
Return the message type (of the form "type/subtype")
as specified in the content-type header. If no such header
exists, return 'text/plain'. The type is converted to lower
case.
getmaintype ()
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 ()
Return the subtype as specified in the content-type header. If
no such header exists, return 'plain'. The subtype is
converted to lower case.
Python Library Reference
Previous: 12.3 mimetools
Up: 12.3 mimetools
Next: 12.4 MimeWriter
See About this document... for information on suggesting changes.
Wyszukiwarka
Podobne podstrony:
message objectsmh message objectsstream writer objectsObjectImplfunction hwapi object remove110 Amazing Magic Tricks With Everyday ObjectsWindows Messagesfunction pg fetch objectObjectsubject object questionsmessage5 (2)Objectbltin code objectsPrettyPrinter Objectsfunction mssql get last messagemessageboxesframecontent handler objectsObjectStreamFieldwięcej podobnych podstron