gpt4 book ai didi

scrapy:我可以从响应中提取请求表单数据吗?

转载 作者:行者123 更新时间:2023-12-01 13:46:47 25 4
gpt4 key购买 nike

我正在使用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:我可以从响应中提取请求表单数据吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35382915/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com