我正在尝试使用Python3从网站下载csv文件,这是我的代码:
import requests
from contextlib import closing
import csv
url = "http://www.cnac.ca/data/COCodeStatus_NPA204.csv"
with closing(requests.get(url, stream=True)) as r:
reader = csv.reader(r.iter_lines(), delimiter=',', quotechar='"')
for row in reader:
print (row)
错误消息是:
引发ConnectionError(e,request = request)
ConnectionError:HTTPConnectionPool(主机= 'www.cnac.ca',端口= 80):最大重试次数超过与网址:/data/COCodeStatus_NPA204.csv(由NewConnectionError('引起:未能建立新的连接:[错误11004] getaddrinfo失败',))
我该如何解决/修复/调试这个?