doc
This commit is contained in:
parent
c148b94be1
commit
8fea330537
1 changed files with 13 additions and 0 deletions
13
gpgmymail
13
gpgmymail
|
@ -83,6 +83,19 @@ def decode_email(message: email.message.Message) -> email.message.Message:
|
||||||
decoded_bytes: bytes,
|
decoded_bytes: bytes,
|
||||||
most_recent_boundary: str = None
|
most_recent_boundary: str = None
|
||||||
) -> bytes:
|
) -> bytes:
|
||||||
|
"""
|
||||||
|
change decoded_bytes such that part is decoded if base64 (unchanged if
|
||||||
|
not)
|
||||||
|
|
||||||
|
see usage below for examples
|
||||||
|
|
||||||
|
:param part: email.message.Message to be decoded
|
||||||
|
:param decoded_bytes: the email as a bytes object (ie not a string with
|
||||||
|
encoding), will have modified version returned
|
||||||
|
:param most_recent_boundary: str of the most recent boundary so we
|
||||||
|
don't overwrite this
|
||||||
|
:return: bytes of decoded_bytes with part decoded if base64
|
||||||
|
"""
|
||||||
if part.get("Content-Transfer-Encoding") == "base64":
|
if part.get("Content-Transfer-Encoding") == "base64":
|
||||||
b64_str = part.get_payload()
|
b64_str = part.get_payload()
|
||||||
# remove the boundary as we don't want to change this
|
# remove the boundary as we don't want to change this
|
||||||
|
|
Loading…
Reference in a new issue