gpt4 book ai didi

python - 在 Python 中使用 scrapy 时出错

转载 作者:太空宇宙 更新时间:2023-11-03 14:17:44 25 4
gpt4 key购买 nike

我一直在尝试运行 scrapy 来抓取网站,但每次我尝试运行时都会遇到一些问题。当我在命令行上运行时

scrapy crawl [FILE]

我得到了一堆以

开头的错误
Traceback (most recent call last):
File "C:\Users\lib\site-packages\boto\utils.py", line 210, in r
etry_url
r = opener.open(req, timeout=timeout)
File "C:\Users\lib\urllib2.py", line 431, in open
response = self._open(req, data)
File "C:\Users\lib\urllib2.py", line 449, in _open
'_open', req)
File "C:\Users\lib\urllib2.py", line 409, in _call_chain
result = func(*args)
File "C:\Users\lib\urllib2.py", line 1227, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Users\lib\urllib2.py", line 1197, in do_open
raise URLError(err)
URLError: <urlopen error timed out>
2015-08-06 14:50:49 [boto] ERROR: Unable to read instance data, giving up

到底是什么阻止我运行 Scrapy?

编辑我环顾了 stackoverflow 并稍微更改了我的设置,这似乎消除了一个错误,但这些错误仍然存​​在。我尝试运行 scrapy shell,它也给我错误,我认为这与我当前收到的错误有关。

2015-08-08 15:08:27 [scrapy] INFO: Scrapy 1.0.1 started (bot: scrapybot)
2015-08-08 15:08:27 [scrapy] INFO: Optional features available: ssl, http11, bot
o
2015-08-08 15:08:27 [scrapy] INFO: Overridden settings: {'LOGSTATS_INTERVAL': 0}

2015-08-08 15:08:27 [scrapy] INFO: Enabled extensions: CloseSpider, TelnetConsol
e, CoreStats, SpiderState
2015-08-08 15:08:28 [boto] DEBUG: Retrieving credentials from metadata server.
2015-08-08 15:08:29 [boto] ERROR: Caught exception reading instance data
Traceback (most recent call last):
File "C:\Users\lib\site-packages\boto\utils.py", line 210, in retry_url
r = opener.open(req, timeout=timeout)
File "C:\Users\lib\urllib2.py", line 431, in open
response = self._open(req, data)
File "C:\Users\lib\urllib2.py", line 449, in _open
'_open', req)
File "C:\Users\lib\urllib2.py", line 409, in _call_chain
result = func(*args)
File "C:\Users\lib\urllib2.py", line 1227, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Users\lib\urllib2.py", line 1197, in do_open
raise URLError(err)
URLError: <urlopen error timed out>
2015-08-08 15:08:29 [boto] ERROR: Unable to read instance data, giving up
2015-08-08 15:08:29 [scrapy] INFO: Enabled downloader middlewares: HttpAuthMiddleware, DownloadTimeoutMiddleware, UserAgentMiddleware, RetryMiddleware, DefaultHeadersMiddleware, MetaRefreshMiddleware, HttpCompressionMiddleware, RedirectMiddleware, CookiesMiddleware, ChunkedTransferMiddleware, DownloaderStats
2015-08-08 15:08:29 [scrapy] INFO: Enabled spider middlewares: HttpErrorMiddleware, OffsiteMiddleware, RefererMiddleware, UrlLengthMiddleware, DepthMiddleware
2015-08-08 15:08:29 [scrapy] INFO: Enabled item pipelines:
2015-08-08 15:08:29 [scrapy] DEBUG: Telnet console listening on 127.0.0.1:6023

最佳答案

尝试通过将以下行添加到文件 ~/your_project/settings.py 来禁用 S3 处理程序:

DOWNLOAD_HANDLERS = {'s3': None}

关于python - 在 Python 中使用 scrapy 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31863882/

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