python 爬取数据intraday_利用Python进行数据分析(11):金融和经济数据应用

在使用Python进行金融和经济数据分析时,尝试从Yahoo Finance获取Intraday数据时遇到了`getaddrinfo failed`错误。错误源于`requests`库在建立新连接时失败。这可能是由于网络问题或DNS解析错误导致的。为解决此问题,可以检查网络连接,尝试更换DNS服务器,或者使用代理设置来重新发起请求。
摘要由CSDN通过智能技术生成

---------------------------------------------------------------------------

gaierror Traceback (most recent call last)

C:\ProgramData\Anaconda3\lib\site-packages\requests\packages\urllib3\connection.py in _new_conn(self)

137 conn = connection.create_connection(

--> 138(self.host, self.port), self.timeout, **extra_kw)139

C:\ProgramData\Anaconda3\lib\site-packages\requests\packages\urllib3\util\connection.py in create_connection(address, timeout, source_address, socket_options)

74

---> 75for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):

76 af, socktype, proto, canonname, sa = res

C:\ProgramData\Anaconda3\lib\socket.py in getaddrinfo(host, port, family, type, proto, flags)

742 addrlist = []

--> 743for res in _socket.getaddrinfo(host, port, family, type, proto, flags):

744 af, socktype, proto, canonname, sa = res

gaierror: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

NewConnectionError Traceback (most recent call last)

C:\ProgramData\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, **response_kw)

593 body=body, headers=headers,

--> 594chunked=chunked)595

C:\ProgramData\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)

360 else:

--> 361conn.request(method, url, **httplib_request_kw)

362

C:\ProgramData\Anaconda3\lib\http\client.py in request(self, method, url, body, headers, encode_chunked)

1238 """Send a complete request to the server."""

-> 1239self._send_re

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值