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


Python conf.arglist_to_dict方法代碼示例

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


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

示例1: process_options

# 需要導入模塊: from scrapy.utils import conf [as 別名]
# 或者: from scrapy.utils.conf import arglist_to_dict [as 別名]
def process_options(self, args, opts):
        try:
            self.settings.setdict(arglist_to_dict(opts.set),
                                  priority='cmdline')
        except ValueError:
            raise UsageError("Invalid -s value, use -s NAME=VALUE", print_help=False)

        if opts.logfile:
            self.settings.set('LOG_ENABLED', True, priority='cmdline')
            self.settings.set('LOG_FILE', opts.logfile, priority='cmdline')

        if opts.loglevel:
            self.settings.set('LOG_ENABLED', True, priority='cmdline')
            self.settings.set('LOG_LEVEL', opts.loglevel, priority='cmdline')

        if opts.nolog:
            self.settings.set('LOG_ENABLED', False, priority='cmdline')

        if opts.pidfile:
            with open(opts.pidfile, "w") as f:
                f.write(str(os.getpid()) + os.linesep)

        if opts.pdb:
            failure.startDebugMode() 
開發者ID:lamphp,項目名稱:scrapy-image,代碼行數:26,代碼來源:__init__.py

示例2: process_options

# 需要導入模塊: from scrapy.utils import conf [as 別名]
# 或者: from scrapy.utils.conf import arglist_to_dict [as 別名]
def process_options(self, args, opts):
        ScrapyCommand.process_options(self, args, opts)
        try:
            opts.spargs = arglist_to_dict(opts.spargs)
        except ValueError:
            raise UsageError("Invalid -a value, use -a NAME=VALUE", print_help=False)
        if opts.output:
            if opts.output == '-':
                self.settings.set('FEED_URI', 'stdout:', priority='cmdline')
            else:
                self.settings.set('FEED_URI', opts.output, priority='cmdline')
            feed_exporters = without_none_values(
                self.settings.getwithbase('FEED_EXPORTERS'))
            valid_output_formats = feed_exporters.keys()
            if not opts.output_format:
                opts.output_format = os.path.splitext(opts.output)[1].replace(".", "")
            if opts.output_format not in valid_output_formats:
                raise UsageError("Unrecognized output format '%s', set one"
                                 " using the '-t' switch or as a file extension"
                                 " from the supported list %s" % (opts.output_format,
                                                                  tuple(valid_output_formats)))
            self.settings.set('FEED_FORMAT', opts.output_format, priority='cmdline')
    #?? 
開發者ID:xiexiaoshinick,項目名稱:User-Python-Write-a-web-crawler,代碼行數:25,代碼來源:??????.py

示例3: process_options

# 需要導入模塊: from scrapy.utils import conf [as 別名]
# 或者: from scrapy.utils.conf import arglist_to_dict [as 別名]
def process_options(self, args, opts):
        ScrapyCommand.process_options(self, args, opts)
        try:
            opts.spargs = arglist_to_dict(opts.spargs)
        except ValueError:
            raise UsageError("Invalid -a value, use -a NAME=VALUE", print_help=False) 
開發者ID:build2last,項目名稱:NCspider,代碼行數:8,代碼來源:allstart.py

示例4: process_options

# 需要導入模塊: from scrapy.utils import conf [as 別名]
# 或者: from scrapy.utils.conf import arglist_to_dict [as 別名]
def process_options(self, args, opts):
		ScrapyCommand.process_options(self, args, opts)
		try:
			opts.spargs = arglist_to_dict(opts.spargs)
		except ValueError:
			raise UsageError("Invalid -a value, use -a NAME=VALUE", print_help=False) 
開發者ID:Martian2Lee,項目名稱:Web-Scraping,代碼行數:8,代碼來源:crawlall.py

示例5: process_options

# 需要導入模塊: from scrapy.utils import conf [as 別名]
# 或者: from scrapy.utils.conf import arglist_to_dict [as 別名]
def process_options(self,args,opts):
		ScrapyCommand.process_options(self,args,opts)
		try:
			opts.spargs = arglist_to_dict(opts.spargs)
		except ValueError:
			raise UsageError("Invalid -a value,use -a NAME=VALUE",print_help=False) 
開發者ID:tingyunsay,項目名稱:music_Spider,代碼行數:8,代碼來源:crawlall.py


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