google.appengine.api.mail.EncodedPayload

Wrapper for a payload that contains encoding information.

Inherits From: expected_type

When an email is received, it is usually encoded using a certain character set, then possibly further encoded using a transfer encoding in that character set. Most of the time, it is possible to decode the encoded payload as-is; however, in the case where it is not, the encoded payload and the original encoding information must be preserved.

payload Maps to an attribute of the same name.
charset Maps to an attribute of the same name.
encoding Maps to an attribute of the same name.

payload The original encoded payload.
charset The character set of the encoded payload. To specify that you want to use the default character set, set this argument to None.
encoding The transfer encoding of the encoded payload. To specify that you do not want the content to be encoded, set this argument to None.

Methods

copy_to

View source

Copies the contents of a message to a MIME message payload.

If no content transfer encoding is specified and the character set does not equal the overall message encoding, the payload will be base64-encoded.

Args
mime_message Message instance that will receive the new payload.

decode

View source

Attempts to decode the encoded data.

This function attempts to use Python's codec library_ to decode the payload. All exceptions are passed back to the caller.

Returns
The binary or Unicode version of the payload content.

.. _Python's codec library: https://docs.python.org/2/library/codecs.html

to_mime_message

View source

Converts a message to a MIME message.

Returns
The MIME message instance of the payload.

__eq__

View source

Equality operator.

Args
other The other EncodedPayload object with which to compare. Comparison with other object types are not implemented.

Returns
True if the payload and encodings are equal; otherwise returns False.