无法下载https类型的资源-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

无法下载https类型的资源

游客awtd46antogh6 2019-09-29 15:45:54 141
import pandas as pd
url_all = "https://sc.hkex.com.hk/TuniS/www.hkex.com.hk/chi/services/trading/securities/securitieslists/ListOfSecurities_c.xlsx"
stocks = pd.read_excel(url_all,skiprows=2,dtype=str)

很简单的代码,下载网页资源,读取成一个数据框。

总是有错误

File "<stdin>", line 1, in <module>
  File "/usr/local/lib64/python3.6/site-packages/pandas/util/_decorators.py", line 208, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib64/python3.6/site-packages/pandas/io/excel/_base.py", line 310, in read_excel
    io = ExcelFile(io, engine=engine)
  File "/usr/local/lib64/python3.6/site-packages/pandas/io/excel/_base.py", line 819, in __init__
    self._reader = self._engines[engine](self._io)
  File "/usr/local/lib64/python3.6/site-packages/pandas/io/excel/_xlrd.py", line 21, in __init__
    super().__init__(filepath_or_buffer)
  File "/usr/local/lib64/python3.6/site-packages/pandas/io/excel/_base.py", line 348, in __init__
    filepath_or_buffer = BytesIO(urlopen(filepath_or_buffer).read())
  File "/usr/lib64/python3.6/http/client.py", line 472, in read
    s = self._safe_read(self.length)
  File "/usr/lib64/python3.6/http/client.py", line 622, in _safe_read
    chunk = self.fp.read(min(amt, MAXAMOUNT))
  File "/usr/lib64/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib64/python3.6/ssl.py", line 968, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib64/python3.6/ssl.py", line 830, in read
    return self._sslobj.read(len, buffer)
  File "/usr/lib64/python3.6/ssl.py", line 587, in read
    v = self._sslobj.read(len, buffer)

请问,如何解决?

分享到
取消 提交回答
全部回答(0)
云计算
使用钉钉扫一扫加入圈子
+ 订阅

时时分享云计算技术内容,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。

推荐文章