关于python:如何在scrapy-splash 中设置飞溅超时?

How to set splash timeout in scrapy-splash?

我使用scrapy-splash抓取网页,并在docker上运行splash服务。

命令:

1
docker run -p 8050:8050 scrapinghub/splash --max-timeout 3600

但我收到了 504 错误。

1
"error": {"info": {"timeout": 30},"description":"Timeout exceeded rendering page","error": 504,"type":"GlobalTimeoutError"}

尽管我尝试添加 splash.resource_timeoutrequest:set_timeoutSPLASH_URL = 'http://localhost:8050?timeout=1800.0',但没有任何改变。

感谢您的帮助。


我使用 scrapy-splash 包并在 SplashRequestargs 参数中设置超时,如下所示:

1
2
3
yield scrapy_splash.SplashRequest(
    url, self.parse, endpoint='execute',
    args={'lua_source': script, 'timeout': 3600})

它对我有用。