yfinance 不工作 - 接收 json.decoder.JSONDecodeError [英] yfinance not working - receiving json.decoder.JSONDecodeError

查看:36
本文介绍了yfinance 不工作 - 接收 json.decoder.JSONDecodeError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

<块引用>

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

执行时:

将 yfinance 导入为 yftsla_df = yf.download('TSLA', start='2020-01-01', end='2021-01-01', progress=False)

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

解决方案

yfinance已经提出问题,需要升级

关注这里

https://github.com/ranaroussi/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卸载yfinancepip 安装 git+https://github.com/ranaroussi/yfinance.git#egg=yfinance

I am scraping stock market data from yfinance. My code worked perfectly during the last weeks. For some reason, now I am receiving the following error:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

when executing:

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

I have read about this error on Stack Overflow, but no one had an appropriate solution to fix the problem. I am wondering because this simple code worked well days ago. So maybe there is a general problem with the yfinance API at the moment? Can anyone confirm or has a solution for this problem?

解决方案

Issue has been raised with yfinance, you need to upgrade

Follow here

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

from github:

If you're getting an json.decoder.JSONDecodeError related error, please upgrade to yfinance 0.1.62. Upgrade using:

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

Full conversation here : https://github.com/ranaroussi/yfinance/issues/760

I couldn't get the fix to work but this comment worked for me https://github.com/ranaroussi/yfinance/issues/760#issuecomment-877379498

pip uninstall yfinance
pip install git+https://github.com/ranaroussi/yfinance.git#egg=yfinance

这篇关于yfinance 不工作 - 接收 json.decoder.JSONDecodeError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆