当前位置: 首页>>代码示例>>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;未经允许,请勿转载。