mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
#24277: The new email API is no longer provisional.
This is a wholesale reorganization and editing of the email documentation to make the new API the standard one, and the old API the 'legacy' one. The default is still the compat32 policy, for backward compatibility. We will change that eventually.
This commit is contained in:
parent
23e8633781
commit
29d1bc0842
25 changed files with 2078 additions and 1670 deletions
|
@ -3,11 +3,11 @@
|
|||
"""Unpack a MIME message into a directory of files."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import email
|
||||
import errno
|
||||
import mimetypes
|
||||
|
||||
from email.policy import default
|
||||
|
||||
from argparse import ArgumentParser
|
||||
|
||||
|
||||
|
@ -22,8 +22,8 @@ Unpack a MIME message into a directory of files.
|
|||
parser.add_argument('msgfile')
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.msgfile) as fp:
|
||||
msg = email.message_from_file(fp)
|
||||
with open(args.msgfile, 'rb') as fp:
|
||||
msg = email.message_from_binary_file(fp, policy=default)
|
||||
|
||||
try:
|
||||
os.mkdir(args.directory)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue