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


Python downloader.Downloader类代码示例

本文整理汇总了Python中webpage.downloader.Downloader的典型用法代码示例。如果您正苦于以下问题:Python Downloader类的具体用法?Python Downloader怎么用?Python Downloader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testDownloading_stackoverflow_2

    def testDownloading_stackoverflow_2(self):
        from webpage.downloader import Downloader, DownloadController

        controller = DownloadController(self._tempDir, self._staticDirName)
        downloader = Downloader()

        url = 'https://ru.stackoverflow.com/questions/241337/Как-обработать-кириллические-символы-в-urllib-request-urlopen'
        downloader.start(url, controller)

        self.assertTrue(downloader.success)
开发者ID:Jenyay,项目名称:outwiker,代码行数:10,代码来源:test_real.py

示例2: testDownloading_stackoverflow_01

    def testDownloading_stackoverflow_01(self):
        from webpage.downloader import Downloader, DownloadController

        controller = DownloadController(self._tempDir, self._staticDirName)
        downloader = Downloader()

        url = 'http://ru.stackoverflow.com/questions/476918/django-%D0%97%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B5-%D0%B2-%D0%B7%D0%B0%D0%B2%D0%B8%D1%81%D0%B8%D0%BC%D0%BE%D1%81%D1%82%D0%B8-%D0%BE%D1%82-%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B9-%D0%B2-%D0%91%D0%94'
        downloader.start(url, controller)

        self.assertTrue(downloader.success)
开发者ID:Jenyay,项目名称:outwiker,代码行数:10,代码来源:test_real.py

示例3: testDownloading_toster

    def testDownloading_toster(self):
        from webpage.downloader import Downloader, DownloadController

        controller = DownloadController(self._tempDir, self._staticDirName)
        downloader = Downloader()

        url = 'https://toster.ru/q/273244'
        downloader.start(url, controller)

        self.assertTrue(downloader.success)
开发者ID:Jenyay,项目名称:outwiker,代码行数:10,代码来源:test_real.py

示例4: testDownloading_beautifulsoup

    def testDownloading_beautifulsoup(self):
        from webpage.downloader import Downloader, DownloadController

        controller = DownloadController(self._tempDir, self._staticDirName)
        downloader = Downloader()

        url = 'http://www.crummy.com/software/BeautifulSoup/bs4/doc/'
        downloader.start(url, controller)

        self.assertTrue(downloader.success)

        downloadDir = os.path.join(self._tempDir, self._staticDirName)
        self.assertTrue(os.path.exists(downloadDir))

        self.assertTrue(os.path.join(
            self._tempDir,
            self._staticDirName,
            'default.css')
        )

        self.assertTrue(os.path.join(
            self._tempDir,
            self._staticDirName,
            'pygments.css')
        )

        self.assertTrue(os.path.join(
            self._tempDir,
            self._staticDirName,
            'jquery.js')
        )

        self.assertTrue(os.path.join(
            self._tempDir,
            self._staticDirName,
            'underscore.js')
        )

        self.assertTrue(os.path.join(
            self._tempDir,
            self._staticDirName,
            'doctools.js')
        )
开发者ID:Jenyay,项目名称:outwiker,代码行数:43,代码来源:test_real.py

示例5: testDownloading_css_03

    def testDownloading_css_03(self):
        from webpage.downloader import Downloader, DownloadController

        controller = DownloadController(self._tempDir, self._staticDirName)
        downloader = Downloader()

        examplePath = '../test/webpage/Пример 3/'
        exampleHtmlPath = os.path.join(examplePath, 'пример 3.html')

        downloader.start(self._path2url(exampleHtmlPath), controller)

        downloadDir = os.path.join(self._tempDir, self._staticDirName)

        fname1 = os.path.join(self._tempDir,
                              self._staticDirName,
                              'fname1.css')

        fname2 = os.path.join(self._tempDir,
                              self._staticDirName,
                              'fname2.css')

        fname3 = os.path.join(self._tempDir,
                              self._staticDirName,
                              'fname3.css')

        fname4 = os.path.join(self._tempDir,
                              self._staticDirName,
                              'fname4.css')

        fname5 = os.path.join(self._tempDir,
                              self._staticDirName,
                              'fname1_1.css')

        self.assertTrue(os.path.exists(downloadDir))
        self.assertTrue(os.path.exists(fname1))
        self.assertTrue(os.path.exists(fname2))
        self.assertTrue(os.path.exists(fname3))
        self.assertTrue(os.path.exists(fname4))
        self.assertTrue(os.path.exists(fname5))
开发者ID:Jenyay,项目名称:outwiker,代码行数:39,代码来源:test_downloader.py

示例6: testContentScriptExample1

    def testContentScriptExample1(self):
        from webpage.downloader import Downloader, DownloadController

        template = '<script src="{path}"'

        controller = DownloadController(self._tempDir, self._staticDirName)
        downloader = Downloader()

        examplePath = '../test/webpage/example1/'
        exampleHtmlPath = os.path.join(examplePath, 'example1.html')

        downloader.start(self._path2url(exampleHtmlPath), controller)

        self.assertIn(
            template.format(path=self._staticDirName + '/fname1.js'),
            downloader.contentResult)

        self.assertIn(
            template.format(path=self._staticDirName + '/fname2.js'),
            downloader.contentResult)

        self.assertIn(
            template.format(path=self._staticDirName + '/fname2_1.js'),
            downloader.contentResult)

        self.assertIn(
            template.format(path=self._staticDirName + '/fname3.js'),
            downloader.contentResult)

        self.assertIn(
            template.format(path=self._staticDirName + '/fname4.js'),
            downloader.contentResult)

        self.assertNotIn(
            template.format(path=self._staticDirName + '/fname1_1.js'),
            downloader.contentResult)
开发者ID:Jenyay,项目名称:outwiker,代码行数:36,代码来源:test_downloader.py


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