ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
13k stars 2.3k forks source link

.info throwing Exception: yfinance failed to decrypt Yahoo data response #1456

Closed wkasmc closed 1 year ago

wkasmc commented 1 year ago

Hi,

I am running:

import yfinance as yf ; print(yf.version) msft = yf.Ticker("MSFT") msft.info

on Windows 10 Home, Python 3.9 and yfinance Version 2.12

and get the following error/exception message:

0.2.12 Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2021.1.1\plugins\python\helpers\pydev\pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm 2021.1.1\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/Users/micha/PycharmProjects/AIM/AIMOptimizer/yf_test.py", line 7, in msft.info File "C:\Users\micha\PycharmProjects\AIM\venv\lib\site-packages\yfinance\ticker.py", line 138, in info return self.get_info() File "C:\Users\micha\PycharmProjects\AIM\venv\lib\site-packages\yfinance\base.py", line 1475, in get_info data = self._quote.info File "C:\Users\micha\PycharmProjects\AIM\venv\lib\site-packages\yfinance\scrapers\quote.py", line 95, in info self._scrape(self.proxy) File "C:\Users\micha\PycharmProjects\AIM\venv\lib\site-packages\yfinance\scrapers\quote.py", line 124, in _scrape json_data = self._data.get_json_data_stores(proxy=proxy) File "C:\Users\micha\PycharmProjects\AIM\venv\lib\site-packages\yfinance\data.py", line 41, in wrapped return func(*args, **kwargs) File "C:\Users\micha\PycharmProjects\AIM\venv\lib\site-packages\yfinance\data.py", line 311, in get_json_data_stores stores = decrypt_cryptojs_aes_stores(data, keys) File "C:\Users\micha\PycharmProjects\AIM\venv\lib\site-packages\yfinance\data.py", line 162, in decrypt_cryptojs_aes_stores raise Exception("yfinance failed to decrypt Yahoo data response") Exception: yfinance failed to decrypt Yahoo data response

Process finished with exit code -1

Thanks a lot, Michael

RealmX1 commented 1 year ago

You probably need to upgrade the package try update using 'pip install yfinance --upgrade' if you are on linux. look at the readme at front page of this repo for more information about updating on other platforms