当前位置: 首页>>代码示例>>Python>>正文


Python Errors.HeaderParseError方法代码示例

本文整理汇总了Python中email.Errors.HeaderParseError方法的典型用法代码示例。如果您正苦于以下问题:Python Errors.HeaderParseError方法的具体用法?Python Errors.HeaderParseError怎么用?Python Errors.HeaderParseError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在email.Errors的用法示例。


在下文中一共展示了Errors.HeaderParseError方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_set_boundary

# 需要导入模块: from email import Errors [as 别名]
# 或者: from email.Errors import HeaderParseError [as 别名]
def test_set_boundary(self):
        eq = self.assertEqual
        # This one has no existing boundary parameter, but the Content-Type:
        # header appears fifth.
        msg = self._msgobj('msg_01.txt')
        msg.set_boundary('BOUNDARY')
        header, value = msg.items()[4]
        eq(header.lower(), 'content-type')
        eq(value, 'text/plain; charset="us-ascii"; boundary="BOUNDARY"')
        # This one has a Content-Type: header, with a boundary, stuck in the
        # middle of its headers.  Make sure the order is preserved; it should
        # be fifth.
        msg = self._msgobj('msg_04.txt')
        msg.set_boundary('BOUNDARY')
        header, value = msg.items()[4]
        eq(header.lower(), 'content-type')
        eq(value, 'multipart/mixed; boundary="BOUNDARY"')
        # And this one has no Content-Type: header at all.
        msg = self._msgobj('msg_03.txt')
        self.assertRaises(Errors.HeaderParseError,
                          msg.set_boundary, 'BOUNDARY') 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:23,代码来源:test_email.py

示例2: test_broken_base64_header

# 需要导入模块: from email import Errors [as 别名]
# 或者: from email.Errors import HeaderParseError [as 别名]
def test_broken_base64_header(self):
        raises = self.assertRaises
        s = 'Subject: =?EUC-KR?B?CSixpLDtKSC/7Liuvsax4iC6uLmwMcijIKHaILzSwd/H0SC8+LCjwLsgv7W/+Mj3IQ?='
        raises(Errors.HeaderParseError, decode_header, s)



# Test RFC 2231 header parameters (en/de)coding 
开发者ID:sugarguo,项目名称:Flask_Blog,代码行数:10,代码来源:test_email.py

示例3: test_embeded_header_via_Header_rejected

# 需要导入模块: from email import Errors [as 别名]
# 或者: from email.Errors import HeaderParseError [as 别名]
def test_embeded_header_via_Header_rejected(self):
        msg = Message()
        msg['Dummy'] = Header('dummy\nX-Injected-Header: test')
        self.assertRaises(Errors.HeaderParseError, msg.as_string) 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:6,代码来源:test_email.py

示例4: test_embeded_header_via_string_rejected

# 需要导入模块: from email import Errors [as 别名]
# 或者: from email.Errors import HeaderParseError [as 别名]
def test_embeded_header_via_string_rejected(self):
        msg = Message()
        msg['Dummy'] = 'dummy\nX-Injected-Header: test'
        self.assertRaises(Errors.HeaderParseError, msg.as_string)


# Test the email.Encoders module 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:9,代码来源:test_email.py

示例5: test_broken_base64_header

# 需要导入模块: from email import Errors [as 别名]
# 或者: from email.Errors import HeaderParseError [as 别名]
def test_broken_base64_header(self):
        raises = self.assertRaises
        s = 'Subject: =?EUC-KR?B?CSixpLDtKSC/7Liuvsax4iC6uLmwMcijIKHaILzSwd/H0SC8+LCjwLsgv7W/+Mj3I ?='
        raises(Errors.HeaderParseError, decode_header, s)

    # Issue 1078919 
开发者ID:adde88,项目名称:hostapd-mana,代码行数:8,代码来源:test_email.py

示例6: test_embedded_header_via_Header_rejected

# 需要导入模块: from email import Errors [as 别名]
# 或者: from email.Errors import HeaderParseError [as 别名]
def test_embedded_header_via_Header_rejected(self):
        msg = Message()
        msg['Dummy'] = Header('dummy\nX-Injected-Header: test')
        self.assertRaises(Errors.HeaderParseError, msg.as_string) 
开发者ID:oilshell,项目名称:oil,代码行数:6,代码来源:test_email.py

示例7: test_embedded_header_via_string_rejected

# 需要导入模块: from email import Errors [as 别名]
# 或者: from email.Errors import HeaderParseError [as 别名]
def test_embedded_header_via_string_rejected(self):
        msg = Message()
        msg['Dummy'] = 'dummy\nX-Injected-Header: test'
        self.assertRaises(Errors.HeaderParseError, msg.as_string)


# Test the email.Encoders module 
开发者ID:oilshell,项目名称:oil,代码行数:9,代码来源:test_email.py


注:本文中的email.Errors.HeaderParseError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。