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


Python SGMLParser.get_clear_text_body方法代码示例

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


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

示例1: test_get_clear_text_body

# 需要导入模块: from w3af.core.data.parsers.doc.sgml import SGMLParser [as 别名]
# 或者: from w3af.core.data.parsers.doc.sgml.SGMLParser import get_clear_text_body [as 别名]
    def test_get_clear_text_body(self):
        html = 'header <b>ABC</b>-<b>DEF</b>-<b>XYZ</b> footer'
        clear_text = 'header ABC-DEF-XYZ footer'
        headers = Headers([('Content-Type', 'text/html')])
        r = build_http_response(self.url, html, headers)

        p = SGMLParser(r)
        p.parse()

        self.assertEquals(clear_text, p.get_clear_text_body())
开发者ID:andresriancho,项目名称:w3af,代码行数:12,代码来源:test_sgml.py

示例2: test_get_clear_text_issue_4402

# 需要导入模块: from w3af.core.data.parsers.doc.sgml import SGMLParser [as 别名]
# 或者: from w3af.core.data.parsers.doc.sgml.SGMLParser import get_clear_text_body [as 别名]
    def test_get_clear_text_issue_4402(self):
        """
        :see: https://github.com/andresriancho/w3af/issues/4402
        """
        test_file_path = 'core/data/url/tests/data/encoding_4402.php'
        test_file = os.path.join(ROOT_PATH, test_file_path)
        body = file(test_file, 'rb').read()

        sample_encodings = [encoding for _, (_, encoding) in TEST_RESPONSES.iteritems()]
        sample_encodings.extend(['', 'utf-8'])

        for encoding in sample_encodings:
            encoding_header = 'text/html; charset=%s' % encoding
            headers = Headers([('Content-Type', encoding_header)])

            r = build_http_response(self.url, body, headers)

            p = SGMLParser(r)
            p.parse()

            p.get_clear_text_body()
开发者ID:andresriancho,项目名称:w3af,代码行数:23,代码来源:test_sgml.py

示例3: test_get_clear_text_body_encodings

# 需要导入模块: from w3af.core.data.parsers.doc.sgml import SGMLParser [as 别名]
# 或者: from w3af.core.data.parsers.doc.sgml.SGMLParser import get_clear_text_body [as 别名]
    def test_get_clear_text_body_encodings(self):

        raise SkipTest('Not sure why this one is failing :S')

        for lang_desc, (body, encoding) in TEST_RESPONSES.iteritems():
            encoding_header = 'text/html; charset=%s' % encoding
            headers = Headers([('Content-Type', encoding_header)])

            encoded_body = body.encode(encoding)
            r = build_http_response(self.url, encoded_body, headers)

            p = SGMLParser(r)
            p.parse()

            ct_body = p.get_clear_text_body()

            # These test strings don't really have tags, so they should be eq
            self.assertEqual(ct_body, body)
开发者ID:andresriancho,项目名称:w3af,代码行数:20,代码来源:test_sgml.py


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