當前位置: 首頁>>代碼示例>>Python>>正文


Python Result.get_data方法代碼示例

本文整理匯總了Python中result.Result.get_data方法的典型用法代碼示例。如果您正苦於以下問題:Python Result.get_data方法的具體用法?Python Result.get_data怎麽用?Python Result.get_data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在result.Result的用法示例。


在下文中一共展示了Result.get_data方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from result import Result [as 別名]
# 或者: from result.Result import get_data [as 別名]
class Crawler:
    name = "Default Crawler"

    def __init__(self, config):
        self.config = config
        self.result = Result(config)

    # String
    def __str__(self):
        return self.name

    # Initiate a crawl using a specific crawl config or the one used when initialized
    def do_Crawl(self, config=None):
        if (config == None):
            config = self.config
        print "Not implemented exception. Do not use this class directly. It should be inherited."
        raise

    # Get - Crawl Config object
    def get_crawl_config(self):
        return self.config

    # Get - Crawl location
    def get_crawl_location(self):
        return self.config.location

    # Get - Crawl protocol
    def get_crawl_protocol(self):
        return self.config.protocol

    # Get - Crawl speed
    def get_crawl_speed(self):
        return self.config.speed

    # Get - Crawl max depth
    def get_crawl_maxDepth(self):
        return self.config.maxDepth

    # Get - Crawl name
    def get_crawl_name(self):
        return self.config.name

    # Get - Crawl depth
    def get_crawl_depth(self):
        return self.config.depth

    # Inc - Crawl Depth + 1
    def inc_crawl_depth(self):
        self.config.depth += 1

    # Set - Crawl speed
    def set_crawl_speed(self, speed):
        self.config.speed = speed

    # Set - Crawl max depth
    def set_crawl_maxDepth(self, maxDepth):
        self.config.maxDepth = maxDepth

    # Set - Crawl name
    def set_crawl_name(self, name):
        self.config.name = name

    # Set - Crawl depth
    def set_crawl_depth(self, depth):
        self.config.depth = depth

    # Get - Crawl Option
    def get_crawl_options(self):
        return self.config.options

    # Add - Crawl Option
    # Option = key value pair <"Option", True/False>
    def add_crawl_option(self, option, value):
        self.config.options[option] = value

    # Get - Result object
    def get_result(self):
        return self.result

    # Get - Result data hash
    # Get the current hash of the data
    def get_result_dataHash(self):
        return self.result.get_dataHash()

    # Get - Result source
    def get_result_source(self):
        return self.result.get_source()

    # Set - Result source
    def set_result_source(self, source):
        self.result.set_source(source)

    # Get - Result data
    def get_result_data(self):
        return self.result.get_data()

    # Set - Result data
    def set_result_data(self, data):
        self.result.set_data(data)

#.........這裏部分代碼省略.........
開發者ID:gitter-badger,項目名稱:Capstone,代碼行數:103,代碼來源:crawler.py


注:本文中的result.Result.get_data方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。