JECSand / yahoofinancials

A powerful financial data module used for pulling data from Yahoo Finance. This module can pull fundamental and technical data for stocks, indexes, currencies, cryptos, ETFs, Mutual Funds, U.S. Treasuries, and commodity futures.
https://pypi.python.org/pypi/yahoofinancials
MIT License
896 stars 214 forks source link

"ValueError: Invalid padding bytes." #122

Closed paulhan93 closed 1 year ago

paulhan93 commented 1 year ago

Hello, is anyone else having issues when trying to run YahooFinance methods? I tried running "get_current_price()" and "get_pe_ratio()" and got "ValueError: Invalid padding bytes." It was working fine yesterday.

RafiAIProj commented 1 year ago

I'm encountering the same problem with "get_financial_stmts", the issue is not consistent and appears randomly

Whunion-hub commented 1 year ago

I get the same error message every time I try to get the balance or income sheet. I don´t know how to fix this error.

Thisisnad commented 1 year ago

I a, having the same issue as well :-(

File "D:\My Documents\4. Data Science Related\1. Python\99. PY Test Env\2. Stocks summary scrape - yahoofinancials.py", line 113, in data_1_stock_price = yahoo_financials_1.get_stock_price_data() File "C:\Anaconda\Anaconda3_2022.10\lib\site-packages\yahoofinancials__init__.py", line 100, in get_stock_price_data return self.get_clean_data(self.get_stock_tech_data('price'), 'price') File "C:\Anaconda\Anaconda3_2022.10\lib\site-packages\yahoofinancials\etl.py", line 598, in get_stock_tech_data return self.get_stock_data(tech_type=tech_type) File "C:\Anaconda\Anaconda3_2022.10\lib\site-packages\yahoofinancials\etl.py", line 585, in get_stock_data dict_ent = self._create_dict_ent(tick, statement_type, tech_type, report_name, hist_obj) File "C:\Anaconda\Anaconda3_2022.10\lib\site-packages\yahoofinancials\etl.py", line 503, in _create_dict_ent re_data = self._scrape_data(YAHOO_URL, tech_type, statement_type) File "C:\Anaconda\Anaconda3_2022.10\lib\site-packages\yahoofinancials\etl.py", line 248, in _scrape_data self._request_handler(url) File "C:\Anaconda\Anaconda3_2022.10\lib\site-packages\yahoofinancials\etl.py", line 221, in _request_handler data = decrypt_cryptojs_aes(re_data) File "C:\Anaconda\Anaconda3_2022.10\lib\site-packages\yahoofinancials\etl.py", line 118, in decrypt_cryptojs_aes plaintext = unpadder.update(plaintext) + unpadder.finalize() File "C:\Anaconda\Anaconda3_2022.10\lib\site-packages\cryptography\hazmat\primitives\padding.py", line 159, in finalize result = _byte_unpadding_check( File "C:\Anaconda\Anaconda3_2022.10\lib\site-packages\cryptography\hazmat\primitives\padding.py", line 101, in _byte_unpadding_check raise ValueError("Invalid padding bytes.") ValueError: Invalid padding bytes.

JECSand commented 1 year ago

Hey all,

Sounds like Yahoo Finance changed things up again. I’ll look into this tonight after work.

JECSand commented 1 year ago

Just went ahead and released v1.10 with a fix for this to PyPI. Please let us know if there's any further issues.