Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="prev" href="module-mimetools.html" /> | |
13 | <link rel="parent" href="module-mimetools.html" /> | |
14 | <link rel="next" href="module-mimetypes.html" /> | |
15 | <meta name='aesop' content='information' /> | |
16 | <title>12.6.1 Additional Methods of Message Objects </title> | |
17 | </head> | |
18 | <body> | |
19 | <DIV CLASS="navigation"> | |
20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
22 | <tr> | |
23 | <td class='online-navigation'><a rel="prev" title="12.6 mimetools " | |
24 | href="module-mimetools.html"><img src='../icons/previous.png' | |
25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
26 | <td class='online-navigation'><a rel="parent" title="12.6 mimetools " | |
27 | href="module-mimetools.html"><img src='../icons/up.png' | |
28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
29 | <td class='online-navigation'><a rel="next" title="12.7 mimetypes " | |
30 | href="module-mimetypes.html"><img src='../icons/next.png' | |
31 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
32 | <td align="center" width="100%">Python Library Reference</td> | |
33 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
34 | href="contents.html"><img src='../icons/contents.png' | |
35 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
36 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
37 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
38 | <td class='online-navigation'><a rel="index" title="Index" | |
39 | href="genindex.html"><img src='../icons/index.png' | |
40 | border='0' height='32' alt='Index' width='32' /></A></td> | |
41 | </tr></table> | |
42 | <div class='online-navigation'> | |
43 | <b class="navlabel">Previous:</b> | |
44 | <a class="sectref" rel="prev" href="module-mimetools.html">12.6 mimetools </A> | |
45 | <b class="navlabel">Up:</b> | |
46 | <a class="sectref" rel="parent" href="module-mimetools.html">12.6 mimetools </A> | |
47 | <b class="navlabel">Next:</b> | |
48 | <a class="sectref" rel="next" href="module-mimetypes.html">12.7 mimetypes </A> | |
49 | </div> | |
50 | <hr /></div> | |
51 | </DIV> | |
52 | <!--End of Navigation Panel--> | |
53 | ||
54 | <H2><A NAME="SECTION0014610000000000000000"></A><A NAME="mimetools-message-objects"></A> | |
55 | <BR> | |
56 | 12.6.1 Additional Methods of Message Objects | |
57 | ||
58 | </H2> | |
59 | ||
60 | <P> | |
61 | The <tt class="class">Message</tt> class defines the following methods in | |
62 | addition to the <tt class="class">rfc822.Message</tt> methods: | |
63 | ||
64 | <P> | |
65 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
66 | <td><nobr><b><tt id='l2h-4012' xml:id='l2h-4012' class="method">getplist</tt></b>(</nobr></td> | |
67 | <td><var></var>)</td></tr></table></dt> | |
68 | <dd> | |
69 | Return the parameter list of the <span class="mailheader">Content-Type:</span> header. | |
70 | This is a list of strings. For parameters of the form | |
71 | "<tt class="samp"><var>key</var>=<var>value</var></tt>", <var>key</var> is converted to lower case but | |
72 | <var>value</var> is not. For example, if the message contains the header | |
73 | "<tt class="samp">Content-type: text/html; spam=1; Spam=2; Spam</tt>" then | |
74 | <tt class="method">getplist()</tt> will return the Python list <code>['spam=1', | |
75 | 'spam=2', 'Spam']</code>. | |
76 | </dl> | |
77 | ||
78 | <P> | |
79 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
80 | <td><nobr><b><tt id='l2h-4013' xml:id='l2h-4013' class="method">getparam</tt></b>(</nobr></td> | |
81 | <td><var>name</var>)</td></tr></table></dt> | |
82 | <dd> | |
83 | Return the <var>value</var> of the first parameter (as returned by | |
84 | <tt class="method">getplist()</tt>) of the form "<tt class="samp"><var>name</var>=<var>value</var></tt>" for the | |
85 | given <var>name</var>. If <var>value</var> is surrounded by quotes of the form | |
86 | `<code><</code>...<code>></code>' or `<code>"</code>...<code>"</code>', these are removed. | |
87 | </dl> | |
88 | ||
89 | <P> | |
90 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
91 | <td><nobr><b><tt id='l2h-4014' xml:id='l2h-4014' class="method">getencoding</tt></b>(</nobr></td> | |
92 | <td><var></var>)</td></tr></table></dt> | |
93 | <dd> | |
94 | Return the encoding specified in the | |
95 | <span class="mailheader">Content-Transfer-Encoding:</span> message header. If no such | |
96 | header exists, return <code>'7bit'</code>. The encoding is converted to | |
97 | lower case. | |
98 | </dl> | |
99 | ||
100 | <P> | |
101 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
102 | <td><nobr><b><tt id='l2h-4015' xml:id='l2h-4015' class="method">gettype</tt></b>(</nobr></td> | |
103 | <td><var></var>)</td></tr></table></dt> | |
104 | <dd> | |
105 | Return the message type (of the form "<tt class="samp"><var>type</var>/<var>subtype</var></tt>") | |
106 | as specified in the <span class="mailheader">Content-Type:</span> header. If no such | |
107 | header exists, return <code>'text/plain'</code>. The type is converted to | |
108 | lower case. | |
109 | </dl> | |
110 | ||
111 | <P> | |
112 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
113 | <td><nobr><b><tt id='l2h-4016' xml:id='l2h-4016' class="method">getmaintype</tt></b>(</nobr></td> | |
114 | <td><var></var>)</td></tr></table></dt> | |
115 | <dd> | |
116 | Return the main type as specified in the <span class="mailheader">Content-Type:</span> | |
117 | header. If no such header exists, return <code>'text'</code>. The main | |
118 | type is converted to lower case. | |
119 | </dl> | |
120 | ||
121 | <P> | |
122 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
123 | <td><nobr><b><tt id='l2h-4017' xml:id='l2h-4017' class="method">getsubtype</tt></b>(</nobr></td> | |
124 | <td><var></var>)</td></tr></table></dt> | |
125 | <dd> | |
126 | Return the subtype as specified in the <span class="mailheader">Content-Type:</span> | |
127 | header. If no such header exists, return <code>'plain'</code>. The subtype | |
128 | is converted to lower case. | |
129 | </dl> | |
130 | ||
131 | <DIV CLASS="navigation"> | |
132 | <div class='online-navigation'> | |
133 | <p></p><hr /> | |
134 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
135 | <tr> | |
136 | <td class='online-navigation'><a rel="prev" title="12.6 mimetools " | |
137 | href="module-mimetools.html"><img src='../icons/previous.png' | |
138 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
139 | <td class='online-navigation'><a rel="parent" title="12.6 mimetools " | |
140 | href="module-mimetools.html"><img src='../icons/up.png' | |
141 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
142 | <td class='online-navigation'><a rel="next" title="12.7 mimetypes " | |
143 | href="module-mimetypes.html"><img src='../icons/next.png' | |
144 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
145 | <td align="center" width="100%">Python Library Reference</td> | |
146 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
147 | href="contents.html"><img src='../icons/contents.png' | |
148 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
149 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
150 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
151 | <td class='online-navigation'><a rel="index" title="Index" | |
152 | href="genindex.html"><img src='../icons/index.png' | |
153 | border='0' height='32' alt='Index' width='32' /></A></td> | |
154 | </tr></table> | |
155 | <div class='online-navigation'> | |
156 | <b class="navlabel">Previous:</b> | |
157 | <a class="sectref" rel="prev" href="module-mimetools.html">12.6 mimetools </A> | |
158 | <b class="navlabel">Up:</b> | |
159 | <a class="sectref" rel="parent" href="module-mimetools.html">12.6 mimetools </A> | |
160 | <b class="navlabel">Next:</b> | |
161 | <a class="sectref" rel="next" href="module-mimetypes.html">12.7 mimetypes </A> | |
162 | </div> | |
163 | </div> | |
164 | <hr /> | |
165 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
166 | </DIV> | |
167 | <!--End of Navigation Panel--> | |
168 | <ADDRESS> | |
169 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
170 | </ADDRESS> | |
171 | </BODY> | |
172 | </HTML> |