本文整理汇总了Python中filter.Filter.create_filter_url方法的典型用法代码示例。如果您正苦于以下问题:Python Filter.create_filter_url方法的具体用法?Python Filter.create_filter_url怎么用?Python Filter.create_filter_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类filter.Filter
的用法示例。
在下文中一共展示了Filter.create_filter_url方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from filter import Filter [as 别名]
# 或者: from filter.Filter import create_filter_url [as 别名]
def run(self):
timer = Timer()
timer.start()
# Create list of search urls
search_urls = []
filter = Filter(self.filter, self.startpage, self.maxpages)
for page in range(self.startpage, self.startpage + self.maxpages):
search_urls.append(filter.create_filter_url((page - 1) * 10))
# Create pool of worker threads
pool = ThreadPool(4)
# Open the urls in their own threads
organisaties = pool.map(unwrap_self_process_search, zip([self] * len(search_urls), search_urls))
pool.close()
pool.join()
results = {}
results["organisaties"] = self.consolidate(organisaties)
timer.stop()
results["stats"] = { "exectime": timer.exectime(), "matches": { "total": str(self.search_results["results"]), "pages": str(self.search_results["pages"]) }, "read": { "page_from": str(self.startpage), "page_to": str(self.maxpages) } }
return results
示例2: __init__
# 需要导入模块: from filter import Filter [as 别名]
# 或者: from filter.Filter import create_filter_url [as 别名]
def __init__(self, filter, startpage, maxpages):
self.filter = filter
self.startpage = startpage
self.maxpages = maxpages
filter = Filter(self.filter, self.startpage, self.maxpages)
self.search_url = filter.create_filter_url(self.startpage)
handler = Handler(self.search_url)
self.search_results = handler.init()
if self.search_results["pages"] < startpage:
raise Exception("Error: startpage exceeds available pages [pages=" + str(self.search_results["pages"]) + "]")
if self.search_results["pages"] < startpage + maxpages:
self.maxpages = self.search_results["pages"]