| LEFT | RIGHT |
| (no file at all) | |
| 1 :mod:`email.message`: Representing an email message | 1 :mod:`email`: Representing an email message |
| 2 --------------------------------------------------- | 2 ------------------------------------------- |
| 3 | 3 |
| 4 .. module:: email.message | 4 .. module:: email.message |
| 5 :synopsis: The base class representing email messages. | 5 :synopsis: The base class representing email messages. |
| 6 | 6 |
| 7 | 7 |
| 8 The central class in the :mod:`email` package is the :class:`Message` class, | 8 The central class in the :mod:`email` package is the :class:`Message` class, |
| 9 imported from the :mod:`email.message` module. It is the base class for the | 9 imported from the :mod:`email.message` module. It is the base class for the |
| 10 :mod:`email` object model. :class:`Message` provides the core functionality for | 10 :mod:`email` object model. :class:`Message` provides the core functionality for |
| 11 setting and querying header fields, and for accessing message bodies. | 11 setting and querying header fields, and for accessing message bodies. |
| 12 | 12 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 ``True``. An :exc:`IndexError` will be raised if *i* is less than 0 or | 104 ``True``. An :exc:`IndexError` will be raised if *i* is less than 0 or |
| 105 greater than or equal to the number of items in the payload. If the | 105 greater than or equal to the number of items in the payload. If the |
| 106 payload is a string (i.e. :meth:`is_multipart` is ``False``) and *i* is | 106 payload is a string (i.e. :meth:`is_multipart` is ``False``) and *i* is |
| 107 given, a :exc:`TypeError` is raised. | 107 given, a :exc:`TypeError` is raised. |
| 108 | 108 |
| 109 Optional *decode* is a flag indicating whether the payload should be | 109 Optional *decode* is a flag indicating whether the payload should be |
| 110 decoded or not, according to the :mailheader:`Content-Transfer-Encoding` | 110 decoded or not, according to the :mailheader:`Content-Transfer-Encoding` |
| 111 header. When ``True`` and the message is not a multipart, the payload will | 111 header. When ``True`` and the message is not a multipart, the payload will |
| 112 be decoded if this header's value is ``quoted-printable`` or ``base64``. | 112 be decoded if this header's value is ``quoted-printable`` or ``base64``. |
| 113 If some other encoding is used, or :mailheader:`Content-Transfer-Encoding` | 113 If some other encoding is used, or :mailheader:`Content-Transfer-Encoding` |
| 114 header is missing, the payload is | 114 header is missing, or if the payload has bogus base64 data, the payload is |
| 115 returned as-is (undecoded). In all cases the returned value is binary | 115 returned as-is (undecoded). In all cases the returned value is binary |
| 116 data. If the message is a multipart and the *decode* flag is ``True``, | 116 data. If the message is a multipart and the *decode* flag is ``True``, |
| 117 then ``None`` is returned. If the payload is base64 and it was not | 117 then ``None`` is returned. |
| 118 perfectly formed (missing padding, characters outside the base64 | |
| 119 alphabet), then an appropriate defect will be added to the message's | |
| 120 defect property (:class:`~email.errors.InvalidBase64PaddingDefect` or | |
| 121 :class:`~email.errors.InvalidBase64CharactersDefect`, respectively). | |
| 122 | 118 |
| 123 When *decode* is ``False`` (the default) the body is returned as a string | 119 When *decode* is ``False`` (the default) the body is returned as a string |
| 124 without decoding the :mailheader:`Content-Transfer-Encoding`. However, | 120 without decoding the :mailheader:`Content-Transfer-Encoding`. However, |
| 125 for a :mailheader:`Content-Transfer-Encoding` of 8bit, an attempt is made | 121 for a :mailheader:`Content-Transfer-Encoding` of 8bit, an attempt is made |
| 126 to decode the original bytes using the ``charset`` specified by the | 122 to decode the original bytes using the ``charset`` specified by the |
| 127 :mailheader:`Content-Type` header, using the ``replace`` error handler. | 123 :mailheader:`Content-Type` header, using the ``replace`` error handler. |
| 128 If no ``charset`` is specified, or if the ``charset`` given is not | 124 If no ``charset`` is specified, or if the ``charset`` given is not |
| 129 recognized by the email package, the body is decoded using the default | 125 recognized by the email package, the body is decoded using the default |
| 130 ASCII charset. | 126 ASCII charset. |
| 131 | 127 |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 | 555 |
| 560 You do not need to set the epilogue to the empty string in order for the | 556 You do not need to set the epilogue to the empty string in order for the |
| 561 :class:`Generator` to print a newline at the end of the file. | 557 :class:`Generator` to print a newline at the end of the file. |
| 562 | 558 |
| 563 | 559 |
| 564 .. attribute:: defects | 560 .. attribute:: defects |
| 565 | 561 |
| 566 The *defects* attribute contains a list of all the problems found when | 562 The *defects* attribute contains a list of all the problems found when |
| 567 parsing this message. See :mod:`email.errors` for a detailed description | 563 parsing this message. See :mod:`email.errors` for a detailed description |
| 568 of the possible parsing defects. | 564 of the possible parsing defects. |
| LEFT | RIGHT |