mirror of
https://github.com/python/cpython.git
synced 2025-11-28 14:11:15 +00:00
Briefly (from the NEWS file):
- Updates for the email package:
+ All deprecated APIs that in email 2.x issued warnings have been removed:
_encoder argument to the MIMEText constructor, Message.add_payload(),
Utils.dump_address_pair(), Utils.decode(), Utils.encode()
+ New deprecations: Generator.__call__(), Message.get_type(),
Message.get_main_type(), Message.get_subtype(), the 'strict' argument to
the Parser constructor. These will be removed in email 3.1.
+ Support for Python earlier than 2.3 has been removed (see PEP 291).
+ All defect classes have been renamed to end in 'Defect'.
+ Some FeedParser fixes; also a MultipartInvariantViolationDefect will be
added to messages that claim to be multipart but really aren't.
+ Updates to documentation.
52 lines
1.2 KiB
Python
52 lines
1.2 KiB
Python
# Copyright (C) 2001-2004 Python Software Foundation
|
||
# Author: Barry Warsaw
|
||
# Contact: email-sig@python.org
|
||
|
||
"""A package for parsing, handling, and generating email messages."""
|
||
|
||
__version__ = '3.0a0'
|
||
|
||
__all__ = [
|
||
'base64MIME',
|
||
'Charset',
|
||
'Encoders',
|
||
'Errors',
|
||
'Generator',
|
||
'Header',
|
||
'Iterators',
|
||
'Message',
|
||
'MIMEAudio',
|
||
'MIMEBase',
|
||
'MIMEImage',
|
||
'MIMEMessage',
|
||
'MIMEMultipart',
|
||
'MIMENonMultipart',
|
||
'MIMEText',
|
||
'Parser',
|
||
'quopriMIME',
|
||
'Utils',
|
||
'message_from_string',
|
||
'message_from_file',
|
||
]
|
||
|
||
|
||
|
||
# Some convenience routines. Don't import Parser and Message as side-effects
|
||
# of importing email since those cascadingly import most of the rest of the
|
||
# email package.
|
||
def message_from_string(s, *args, **kws):
|
||
"""Parse a string into a Message object model.
|
||
|
||
Optional _class and strict are passed to the Parser constructor.
|
||
"""
|
||
from email.Parser import Parser
|
||
return Parser(*args, **kws).parsestr(s)
|
||
|
||
|
||
def message_from_file(fp, *args, **kws):
|
||
"""Read a file and parse its contents into a Message object model.
|
||
|
||
Optional _class and strict are passed to the Parser constructor.
|
||
"""
|
||
from email.Parser import Parser
|
||
return Parser(*args, **kws).parse(fp)
|