我正在使用scrapy抓取一些数据,我想知道Request the Response存储了多少数据。

我的特定问题显示在以下代码中:

def parse(self,response):
    r = FormRequest(url=url1, formdata={somedata}, callback=parse2)

    #is this line necessary if I want the formdata being attached?
    r.meta['formdata'] = formdata

    yield r

def parse2(self,response):
    #can I access to the formdata here without that line of code?

任何建议,将不胜感激。

最佳答案

是的,但是据我记得,formdata已经被转换为body,它不是字典而是字符串。

因此,请尝试使用r.body来快速提醒您,您可以通过以下方式检查对象的属性:dir(r)

关于scrapy - scrapy:我可以从响应中提取请求formdata吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35382915/

10-09 00:26
查看更多