简体   繁体   English

如何在Python中重新运行scrapy请求对象?

[英]How can I rerun a scrapy request object in Python?

I am using Scrapy, and in the response_is_ban function, I have two objects, a {Request} object, and a {Response} object. 我正在使用Scrapy,在response_is_ban函数中,我有两个对象,一个{Request}对象和一个{Response}对象。

from scrapy.http import Request

For some reason, the Scrapy Request is returning different results than a standard Curl. 由于某种原因,Scrapy请求返回的结果与标准Curl不同。

Is there a way I can rerun the {Request} object? 有没有一种方法可以重新运行{Request}对象?

Something like: 就像是:

response = request.get_again()

The goal is to figure out exactly what is different between my Curl function and the Scrapy request object, and why they would be returning different results. 目的是弄清楚我的Curl函数和Scrapy请求对象之间到底有什么区别,以及为什么它们会返回不同的结果。 Any suggestions would be welcomed. 任何建议都将受到欢迎。

Edit: Another question I have, where in the code does Scrapy actually execture the request? 编辑:我有另一个问题,Scrapy在代码中实际上体现了该请求吗? Is there a request.get() function somewhere I could put a debug point on? 我可以在其中放置调试点的地方有request.get()函数吗?

对于调试,您可以从scrapy.shell会话中使用fetchhttps : scrapy.shell

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM