yfinance 不工作 - 接收 json.decoder.JSONDecodeError

mül*_*ann 5 python api yahoo yfinance

我正在从 yfinance 抓取股市数据。在过去的几周里,我的代码运行良好。出于某种原因,现在我收到以下错误:

json.decoder.JSONDecodeError:期望值:第 1 行第 1 列(字符 0)

执行时:

import yfinance as yf
tsla_df = yf.download('TSLA', start='2020-01-01', end='2021-01-01', progress=False)
Run Code Online (Sandbox Code Playgroud)

我在 Stack Overflow 上读到过这个错误,但没有人有合适的解决方案来解决这个问题。我想知道因为这个简单的代码几天前运行良好。那么目前 yfinance API 是否存在普遍问题?任何人都可以确认或解决此问题吗?

Eoi*_*inS 5

已向 yfinance 提出问题,您需要升级

关注这里

https://github.com/ranarossi/yfinance/issues/764

来自github:

如果您收到 json.decoder.JSONDecodeError 相关错误,请升级到 yfinance 0.1.62。升级使用:

$ pip install yfinance -U--no-cache-dir

完整对话在这里: https: //github.com/ranaroussi/yfinance/issues/760

我无法修复该问题,但此评论对我有用 https://github.com/ranaroussi/yfinance/issues/760#issuecomment-877379498

pip uninstall yfinance
pip install git+https://github.com/ranaroussi/yfinance.git#egg=yfinance
Run Code Online (Sandbox Code Playgroud)