我已经尝试下载纳斯达克ITCH文件,但遇到了[WinError 10060]:
from urllib.request import urlretrieve
urlretrieve('ftp://emi.nasdaq.com/ITCH/Nasdaq ITCH/', '10302019.NASDAQ_ITCH50.gz')
---------------------------------------------------------------------------
TimeoutError Traceback (most recent call last)
~anaconda3liburllibrequest.py in ftp_open(self, req)
1562 try:
-> 1563 fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout)
1564 type = file and 'I' or 'D'
~anaconda3liburllibrequest.py in connect_ftp(self, user, passwd, host, port, dirs, timeout)
1583 def connect_ftp(self, user, passwd, host, port, dirs, timeout):
-> 1584 return ftpwrapper(user, passwd, host, port, dirs, timeout,
1585 persistent=False)
~anaconda3liburllibrequest.py in __init__(self, user, passwd, host, port, dirs, timeout, persistent)
2404 try:
-> 2405 self.init()
2406 except:
~anaconda3liburllibrequest.py in init(self)
2413 self.ftp = ftplib.FTP()
-> 2414 self.ftp.connect(self.host, self.port, self.timeout)
2415 self.ftp.login(self.user, self.passwd)
~anaconda3libftplib.py in connect(self, host, port, timeout, source_address)
157 sys.audit("ftplib.connect", self, self.host, self.port)
--> 158 self.sock = socket.create_connection((self.host, self.port), self.timeout,
159 source_address=self.source_address)
~anaconda3libsocket.py in create_connection(address, timeout, source_address)
843 try:
--> 844 raise err
845 finally:
~anaconda3libsocket.py in create_connection(address, timeout, source_address)
831 sock.bind(source_address)
--> 832 sock.connect(sa)
833 # Break explicitly a reference cycle
TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
我试着在谷歌上搜索,有人说这是代理问题,但有人能帮助启发我的正确问题吗?非常感谢。
from urllib。请求导入urlretrieve
urlretrieve (' https://emi.nasdaq.com/ITCH/Nasdaq%20ITCH/', ' 10302019. nasdaq_itch50.gz ')
上面的工作,只是通过将ftp更改为https和'Nasdaq ITCH'更改为'Nasdaq%20ITCH/'。