@斗杆cjfrom stickymeta import stick_cj
stick_meta处理的快捷方式cookiejar作为默认参数
值,因此@stick_cj('a', 'b', 'c')
def parse(self,response):
...
相当于@stick_meta('cookiejar', 'a', 'b', 'c')
def parse(self,response):
...
spider属性sticky_meta也影响到decorators,后面两个
代码片段将以同样的方式处理meta:class TheSpider(scrapy.Spider):
name = 'thespider'
sticky_meta = ('a', 'b', 'c')
@stick_meta()
def parse(self, response):
...
yield Request(url)
vsclass TheSpider(scrapy.Spider):
name = 'thespider'
@stick_meta('a', 'b', 'c')
def parse(self, response):
...
yield Request(url)