yfinance "history" function not working in my python sessions, how can I debug this?

Viewed 935

I'm new to python, and im trying to run a few shareprice related projects.

However .history function never works for me.

import yfinance as yf

msft = yf.Ticker("MSFT")
msft.info
hist = msft.history(period="max")

.info runs fine, however .history produces the following error:

Traceback (most recent call last):
  File "<pyshell#17>", line 1, in <module>
    hist = msft.history(period="max")
  File "C:\Users\thoma\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\yfinance\base.py", line 157, in history
    data = data.json()
  File "C:\Users\thoma\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\requests\models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.1776.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

does anyone know what might be causing this? or how to go about debugging it?

1 Answers

You should upgrade yfinance. Run this on the command line:

pip install yfinance==0.1.62
Related