首页 > 解决方案 > twisted.internet.error.TimeoutError:用户超时导致连接失败

问题描述

我正在尝试运行此命令:

scrapy shell "http://www.zomato.com/sao-paulo-sp/restaurants?page=1"

但我得到:

twisted.internet.error.TimeoutError: User timeout caused connection failure: Getting http://www.zomato.com/sao-paulo-sp/restaurants?page=1 took longer than 180.0 seconds..

这是我的scrapy版本:

scrapy version -v
Scrapy       : 1.5.1
lxml         : 4.2.4.0
libxml2      : 2.9.8
cssselect    : 1.0.3
parsel       : 1.5.0
w3lib        : 1.19.0
Twisted      : 18.7.0
Python       : 2.7.10 (default, Jul 15 2017, 17:16:57) - [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]
pyOpenSSL    : 18.0.0 (OpenSSL 1.1.0f  25 May 2017)
cryptography : 1.9
Platform     : Darwin-17.3.0-x86_64-i386-64bit

我怎样才能解决这个问题?

标签: pythonweb-scrapingscrapy

解决方案


您可能遇到连接问题。开始故障排除:

  • 你打算使用http还是https?
  • 当您将相同的 URL 粘贴到浏览器中时,页面会加载吗?
  • 是某种代理后面的scrapy吗?
  • 可以curl -v ...用来下载页面吗?
  • 您是否有可能被 zomato 限制/阻止?

推荐阅读