本文整理汇总了Python中Crawler.Crawler.crawl_native方法的典型用法代码示例。如果您正苦于以下问题:Python Crawler.crawl_native方法的具体用法?Python Crawler.crawl_native怎么用?Python Crawler.crawl_native使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Crawler.Crawler
的用法示例。
在下文中一共展示了Crawler.crawl_native方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_crawl_native_fakeCrawler
# 需要导入模块: from Crawler import Crawler [as 别名]
# 或者: from Crawler.Crawler import crawl_native [as 别名]
def test_crawl_native_fakeCrawler(self):
parameter_file = "./test/search_parameters.json"
c = Crawler("SimpleTest", parameters=FileOperations.get_from_JSON_file(parameter_file))
self.assertEqual(c.name, "SimpleTest")
c.crawl_native()
self.assertTrue(os.path.isfile(parameter_file))
result_from_file = FileOperations.get_from_JSON_file(c.output["path"])
self.assertEqual(len(result_from_file), 3)
示例2: test_crawl_clientIntegrations
# 需要导入模块: from Crawler import Crawler [as 别名]
# 或者: from Crawler.Crawler import crawl_native [as 别名]
def test_crawl_clientIntegrations(self):
parameter_data = FileOperations.get_from_JSON_file("./test/search_integration.json")
crawlers = parameter_data["crawlers"]
crawlerName = "Integration"
c = Crawler(crawlerName, parameters=crawlers[crawlerName])
data = c.crawl_native()
self.assertTrue(len(data) > 0)
c.save_crawler_data(data, crawlers[crawlerName]["output"])
示例3: test_crawl_multithread_mmcoreAsync
# 需要导入模块: from Crawler import Crawler [as 别名]
# 或者: from Crawler.Crawler import crawl_native [as 别名]
def test_crawl_multithread_mmcoreAsync(self):
parameter_data = FileOperations.get_from_JSON_file("./test/search_async.json")
crawlers = parameter_data["crawlers"]
crawlerName = "dotAsync"
c = Crawler(crawlerName, parameters=crawlers[crawlerName])
data = c.crawl_native(threads=None)
self.assertTrue(len(data) > 0)
c.save_crawler_data(data, crawlers[crawlerName]["output"])
示例4: test_crawl_native_minimalParameterFile_multithreaded
# 需要导入模块: from Crawler import Crawler [as 别名]
# 或者: from Crawler.Crawler import crawl_native [as 别名]
def test_crawl_native_minimalParameterFile_multithreaded(self):
c = Crawler("MyMinimalCrawler", FileOperations.get_from_JSON_file("./test/minimal_parameters.json"))
self.assertEqual(c.crawl_native(threads=10)['./test/test_inputs/minimalist_data.txt']['matches']['HasName']['city'][0], 'London')