gpt4 book ai didi

scrapy - 为什么我的 scrapy 总是告诉我 "TCP connection timed out"

转载 作者:行者123 更新时间:2023-12-01 15:19:42 28 4
gpt4 key购买 nike

DEBUG: Retrying  (failed 2 times): TCP connection timed out: 110: Connection timed out.

ps:System is ubuntu,I can do this successfully:

wget http://www.dmoz.org/Computers/Programming/Languages/Python/Book/

the spider code:

#!/usr/bin/python

from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector

class DmozSpider(BaseSpider):
name = "dmoz"
allowed_domains = ["dmoz.org"]
start_urls = ["http://www.dmoz.org/Computers/Programming/Languages/Python/Books/"]

def parse(self, response):
hxs = HtmlXPathSelector(response)
sites = hxs.select('//ul/li')
for site in sites:
title = site.select('a/text()').extract()
link = site.select('a/@href').extract()
desc = site.select('text()').extract()
print title, link, desc

最佳答案

您的网络出现问题或端口被阻止。

同时检查您的设置是否配置错误。

关于scrapy - 为什么我的 scrapy 总是告诉我 "TCP connection timed out",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18401617/

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