通过Scrapy中的请求在方法之间传递值

2024-10-02 04:16:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要传递一个数组之间的两个函数在Scrapy的蜘蛛后,提出一个新的请求(不同于实际)。我会试着把它表现出来:

def newParse(self, response):
    array = []
    array.append(data1)
    array.append(data2)

def parse(self, response):
    ...................
    extract other data
    ...................
    yield scrapy.Request(newUrl, callback=self.newParse)

    # I want to recover my array here

Tags: 函数selfparseresponsedefextract数组array

热门问题