Skip to main content
 首页 » 编程设计

python之scrapy 中的无效主机名错误

2025年02月15日7over140

我是scrapy新手,遇到了麻烦。当 scrapy 请求下载时:

http://cache.pack.google.com/edgedl/earth/client/GE7/release_7_1_2/GoogleEarth-Win-Bundle-7.1.2.2041.1.exe

我得到一个错误:

twisted.python.failure.Failure exceptions.ValueError: invalid hostname: r2---sn-ug5onuxaxjvh-n8vs.c.pack.google.com

如何解决这个问题?

请您参考如下方法:

您需要将 http 地址放在引号中。 如前所述 here对于 Linux,您可以将地址放在单个引号 '' 中,但对于 Windows 用户,""可能有效。