互联网数据处理¶
本章介绍了一些支持处理因特网上常用数据格式的模块。
email
--- 电子邮件与 MIME 处理包email.message
: 表示一封电子邮件信息EmailMessage
EmailMessage.as_string()
EmailMessage.__str__()
EmailMessage.as_bytes()
EmailMessage.__bytes__()
EmailMessage.is_multipart()
EmailMessage.set_unixfrom()
EmailMessage.get_unixfrom()
EmailMessage.__len__()
EmailMessage.__contains__()
EmailMessage.__getitem__()
EmailMessage.__setitem__()
EmailMessage.__delitem__()
EmailMessage.keys()
EmailMessage.values()
EmailMessage.items()
EmailMessage.get()
EmailMessage.get_all()
EmailMessage.add_header()
EmailMessage.replace_header()
EmailMessage.get_content_type()
EmailMessage.get_content_maintype()
EmailMessage.get_content_subtype()
EmailMessage.get_default_type()
EmailMessage.set_default_type()
EmailMessage.set_param()
EmailMessage.del_param()
EmailMessage.get_filename()
EmailMessage.get_boundary()
EmailMessage.set_boundary()
EmailMessage.get_content_charset()
EmailMessage.get_charsets()
EmailMessage.is_attachment()
EmailMessage.get_content_disposition()
EmailMessage.walk()
EmailMessage.get_body()
EmailMessage.iter_attachments()
EmailMessage.iter_parts()
EmailMessage.get_content()
EmailMessage.set_content()
EmailMessage.make_related()
EmailMessage.make_alternative()
EmailMessage.make_mixed()
EmailMessage.add_related()
EmailMessage.add_alternative()
EmailMessage.add_attachment()
EmailMessage.clear()
EmailMessage.clear_content()
EmailMessage.preamble
EmailMessage.epilogue
EmailMessage.defects
MIMEPart
email.parser
: 解析电子邮件信息email.generator
: 生成 MIME 文档email.policy
: Policy 对象Policy
Policy.max_line_length
Policy.linesep
Policy.cte_type
Policy.raise_on_defect
Policy.mangle_from_
Policy.message_factory
Policy.clone()
Policy.handle_defect()
Policy.register_defect()
Policy.header_max_count()
Policy.header_source_parse()
Policy.header_store_parse()
Policy.header_fetch_parse()
Policy.fold()
Policy.fold_binary()
EmailPolicy
default
SMTP
SMTPUTF8
HTTP
strict
Compat32
compat32
email.errors
: 异常和缺陷类email.headerregistry
: 自定义标头对象email.contentmanager
: 管理 MIME 内容email
: 示例email.message.Message
: 使用compat32
API 来表示电子邮件消息Message
Message.as_string()
Message.__str__()
Message.as_bytes()
Message.__bytes__()
Message.is_multipart()
Message.set_unixfrom()
Message.get_unixfrom()
Message.attach()
Message.get_payload()
Message.set_payload()
Message.set_charset()
Message.get_charset()
Message.__len__()
Message.__contains__()
Message.__getitem__()
Message.__setitem__()
Message.__delitem__()
Message.keys()
Message.values()
Message.items()
Message.get()
Message.get_all()
Message.add_header()
Message.replace_header()
Message.get_content_type()
Message.get_content_maintype()
Message.get_content_subtype()
Message.get_default_type()
Message.set_default_type()
Message.get_params()
Message.get_param()
Message.set_param()
Message.del_param()
Message.set_type()
Message.get_filename()
Message.get_boundary()
Message.set_boundary()
Message.get_content_charset()
Message.get_charsets()
Message.get_content_disposition()
Message.walk()
Message.preamble
Message.epilogue
Message.defects
email.mime
: 从头创建电子邮件和 MIME 对象email.header
: 国际化标头email.charset
: 表示字符集Charset
Charset.input_charset
Charset.header_encoding
Charset.body_encoding
Charset.output_charset
Charset.input_codec
Charset.output_codec
Charset.get_body_encoding()
Charset.get_output_charset()
Charset.header_encode()
Charset.header_encode_lines()
Charset.body_encode()
Charset.__str__()
Charset.__eq__()
Charset.__ne__()
add_charset()
add_alias()
add_codec()
email.encoders
: 编码器email.utils
: 其他工具email.iterators
: 迭代器
json
--- JSON 编码和解码器mailbox
--- 操作多种格式的邮箱Mailbox
对象Mailbox
Mailbox.add()
Mailbox.remove()
Mailbox.__delitem__()
Mailbox.discard()
Mailbox.__setitem__()
Mailbox.iterkeys()
Mailbox.keys()
Mailbox.itervalues()
Mailbox.__iter__()
Mailbox.values()
Mailbox.iteritems()
Mailbox.items()
Mailbox.get()
Mailbox.__getitem__()
Mailbox.get_message()
Mailbox.get_bytes()
Mailbox.get_string()
Mailbox.get_file()
Mailbox.__contains__()
Mailbox.__len__()
Mailbox.clear()
Mailbox.pop()
Mailbox.popitem()
Mailbox.update()
Mailbox.flush()
Mailbox.lock()
Mailbox.unlock()
Mailbox.close()
Maildir
Maildir
Maildir.list_folders()
Maildir.get_folder()
Maildir.add_folder()
Maildir.remove_folder()
Maildir.clean()
Maildir.add()
Maildir.__setitem__()
Maildir.update()
Maildir.flush()
Maildir.lock()
Maildir.unlock()
Maildir.close()
Maildir.get_file()
Maildir.get_flags()
Maildir.set_flags()
Maildir.add_flag()
Maildir.remove_flag()
Maildir.get_info()
Maildir.set_info()
mbox
MH
Babyl
MMDF
Message
对象- 异常
- 例子
mimetypes
--- 映射文件名到 MIME 类型base64
--- Base16, Base32, Base64, Base85 数据编码binascii
--- 二进制和 ASCII 码互转quopri
--- 编码与解码经过 MIME 转码的可打印数据