Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / lib / module-mimetools.html
CommitLineData
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="next" href="module-mimetypes.html" />
13<link rel="prev" href="module-mhlib.html" />
14<link rel="parent" href="netdata.html" />
15<link rel="next" href="mimetools-message-objects.html" />
16<meta name='aesop' content='information' />
17<title>12.6 mimetools -- Tools for parsing MIME messages</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="12.5.3 Message Objects"
25 href="mh-message-objects.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="12. Internet Data Handling"
28 href="netdata.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="12.6.1 Additional Methods of"
31 href="mimetools-message-objects.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="mh-message-objects.html">12.5.3 Message Objects</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="netdata.html">12. Internet Data Handling</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="mimetools-message-objects.html">12.6.1 Additional Methods of</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION0014600000000000000000">
5612.6 <tt class="module">mimetools</tt> --
57 Tools for parsing MIME messages</A>
58</H1>
59
60<P>
61<A NAME="module-mimetools"></A>
62
63<P>
64<div class="versionnote"><b>Deprecated since release 2.3.</b>
65The <tt class="module"><a href="module-email.html">email</a></tt> package should be used in
66 preference to the <tt class="module">mimetools</tt> module. This
67 module is present only to maintain backward
68 compatibility.</div><p></p>
69
70<P>
71This module defines a subclass of the
72<tt class="module"><a href="module-rfc822.html">rfc822</a></tt><a id='l2h-4011' xml:id='l2h-4011'></a> module's
73<tt class="class">Message</tt> class and a number of utility functions that are
74useful for the manipulation for MIME multipart or encoded message.
75
76<P>
77It defines the following items:
78
79<P>
80<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
81 <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-4005' xml:id='l2h-4005' class="class">Message</tt></b>(</nobr></td>
82 <td><var>fp</var><big>[</big><var>, seekable</var><big>]</big><var></var>)</td></tr></table></dt>
83<dd>
84Return a new instance of the <tt class="class">Message</tt> class. This is a
85subclass of the <tt class="class">rfc822.Message</tt> class, with some additional
86methods (see below). The <var>seekable</var> argument has the same meaning
87as for <tt class="class">rfc822.Message</tt>.
88</dl>
89
90<P>
91<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
92 <td><nobr><b><tt id='l2h-4006' xml:id='l2h-4006' class="function">choose_boundary</tt></b>(</nobr></td>
93 <td><var></var>)</td></tr></table></dt>
94<dd>
95Return a unique string that has a high likelihood of being usable as a
96part boundary. The string has the form
97<code>'<var>hostipaddr</var>.<var>uid</var>.<var>pid</var>.<var>timestamp</var>.<var>random</var>'</code>.
98</dl>
99
100<P>
101<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
102 <td><nobr><b><tt id='l2h-4007' xml:id='l2h-4007' class="function">decode</tt></b>(</nobr></td>
103 <td><var>input, output, encoding</var>)</td></tr></table></dt>
104<dd>
105Read data encoded using the allowed MIME <var>encoding</var> from open file
106object <var>input</var> and write the decoded data to open file object
107<var>output</var>. Valid values for <var>encoding</var> include
108<code>'base64'</code>, <code>'quoted-printable'</code>, <code>'uuencode'</code>,
109<code>'x-uuencode'</code>, <code>'uue'</code>, <code>'x-uue'</code>, <code>'7bit'</code>, and
110<code>'8bit'</code>. Decoding messages encoded in <code>'7bit'</code> or <code>'8bit'</code>
111has no effect. The input is simply copied to the output.
112</dl>
113
114<P>
115<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
116 <td><nobr><b><tt id='l2h-4008' xml:id='l2h-4008' class="function">encode</tt></b>(</nobr></td>
117 <td><var>input, output, encoding</var>)</td></tr></table></dt>
118<dd>
119Read data from open file object <var>input</var> and write it encoded using
120the allowed MIME <var>encoding</var> to open file object <var>output</var>.
121Valid values for <var>encoding</var> are the same as for <tt class="method">decode()</tt>.
122</dl>
123
124<P>
125<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
126 <td><nobr><b><tt id='l2h-4009' xml:id='l2h-4009' class="function">copyliteral</tt></b>(</nobr></td>
127 <td><var>input, output</var>)</td></tr></table></dt>
128<dd>
129Read lines from open file <var>input</var> until EOF and write them to
130open file <var>output</var>.
131</dl>
132
133<P>
134<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
135 <td><nobr><b><tt id='l2h-4010' xml:id='l2h-4010' class="function">copybinary</tt></b>(</nobr></td>
136 <td><var>input, output</var>)</td></tr></table></dt>
137<dd>
138Read blocks until EOF from open file <var>input</var> and write them to
139open file <var>output</var>. The block size is currently fixed at 8192.
140</dl>
141
142<P>
143<div class="seealso">
144 <p class="heading">See Also:</p>
145
146 <dl compact="compact" class="seemodule">
147 <dt>Module <b><tt class="module"><a href="module-email.html">email</a></tt>:</b>
148 <dd>Comprehensive email handling package; supersedes
149 the <tt class="module">mimetools</tt> module.
150 </dl>
151 <dl compact="compact" class="seemodule">
152 <dt>Module <b><tt class="module"><a href="module-rfc822.html">rfc822</a></tt>:</b>
153 <dd>Provides the base class for
154 <tt class="class">mimetools.Message</tt>.
155 </dl>
156 <dl compact="compact" class="seemodule">
157 <dt>Module <b><tt class="module"><a href="module-multifile.html">multifile</a></tt>:</b>
158 <dd>Support for reading files which contain
159 distinct parts, such as MIME data.
160 </dl>
161 <dl compact="compact" class="seeurl">
162 <dt><a href="http://www.cs.uu.nl/wais/html/na-dir/mail/mime-faq/.html"
163 class="url">http://www.cs.uu.nl/wais/html/na-dir/mail/mime-faq/.html</a></dt>
164 <dd>
165 The MIME Frequently Asked Questions document. For an
166 overview of MIME, see the answer to question 1.1 in Part 1
167 of this document.</dd>
168 </dl>
169</div>
170
171<P>
172
173<p><br /></p><hr class='online-navigation' />
174<div class='online-navigation'>
175<!--Table of Child-Links-->
176<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a>
177
178<UL CLASS="ChildLinks">
179<LI><A href="mimetools-message-objects.html">12.6.1 Additional Methods of Message Objects</a>
180</ul>
181<!--End of Table of Child-Links-->
182</div>
183
184<DIV CLASS="navigation">
185<div class='online-navigation'>
186<p></p><hr />
187<table align="center" width="100%" cellpadding="0" cellspacing="2">
188<tr>
189<td class='online-navigation'><a rel="prev" title="12.5.3 Message Objects"
190 href="mh-message-objects.html"><img src='../icons/previous.png'
191 border='0' height='32' alt='Previous Page' width='32' /></A></td>
192<td class='online-navigation'><a rel="parent" title="12. Internet Data Handling"
193 href="netdata.html"><img src='../icons/up.png'
194 border='0' height='32' alt='Up One Level' width='32' /></A></td>
195<td class='online-navigation'><a rel="next" title="12.6.1 Additional Methods of"
196 href="mimetools-message-objects.html"><img src='../icons/next.png'
197 border='0' height='32' alt='Next Page' width='32' /></A></td>
198<td align="center" width="100%">Python Library Reference</td>
199<td class='online-navigation'><a rel="contents" title="Table of Contents"
200 href="contents.html"><img src='../icons/contents.png'
201 border='0' height='32' alt='Contents' width='32' /></A></td>
202<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
203 border='0' height='32' alt='Module Index' width='32' /></a></td>
204<td class='online-navigation'><a rel="index" title="Index"
205 href="genindex.html"><img src='../icons/index.png'
206 border='0' height='32' alt='Index' width='32' /></A></td>
207</tr></table>
208<div class='online-navigation'>
209<b class="navlabel">Previous:</b>
210<a class="sectref" rel="prev" href="mh-message-objects.html">12.5.3 Message Objects</A>
211<b class="navlabel">Up:</b>
212<a class="sectref" rel="parent" href="netdata.html">12. Internet Data Handling</A>
213<b class="navlabel">Next:</b>
214<a class="sectref" rel="next" href="mimetools-message-objects.html">12.6.1 Additional Methods of</A>
215</div>
216</div>
217<hr />
218<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
219</DIV>
220<!--End of Navigation Panel-->
221<ADDRESS>
222See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
223</ADDRESS>
224</BODY>
225</HTML>