yahooquery
yahooquery copied to clipboard
Yahoo Finance Premium user log-in issue
Since I'm a yahoo finance premium user. I have been logging-in with the "Ticker" function to get all of the possible data for each ticker. However, recently when I run the same script. I am getting "Invalid credentials provided. Please check username and password and try again." error. This issue was not happening before when I was running a code like this:
from yahooquery import Ticker from datetime import datetime from selenium import webdriver
stocks = ['msft', 'aapl', 'amzn', 'ge', 'bb', 'tsla','brk-a','goog', 'intc','meta','amc','amd','nvda','mmat','ape','tsm']
ticker = Ticker(stocks ,username='redacted', password='redacted')
I have changed my password for yahoo finance multiple times and have checked for any syntax or spelling errors. I am running the most recent chromium web driver with selenium. I also installed the older versions of yahooquery [premium] and selenium to see if it fixes the issue and nothing changed.
This issue started very recently (maybe from 4/17/23). I was using the same script before, and it would log me in as the premium user without an issue. Can you please help me with this and resolve this issue?
I signed up yesterday for Yahoo Finance Premium, and instantly had similar problems. I think @dpguthrie mentioned a while ago on a different issue that this is likely due to Yahoo! changing the location of the 'crumb', an identifier for logged in users. Basically, Yahoo keeps breaking the code in the _get_user_data
function of the login.py
.
For my own use I have patched login.py
in my installation of yahooquery (v. 2.3.1) with the attached patch file. No warranties, but if you'd like to try it, here is how you can apply the patch to your Python environment (assuming you use Linux):
cd <your python environment>/site-packages/yahooquery
patch -u -b login.py -i login.txt
If this change works (remember to restart your Python kernel after making the change), good. If not, you can restore your original version of login.py
with
cp login.py.orig login.py
I too experience this issue but with non-premium account (basic?). Probably because both userId
and crumb
are None
.
Patch from @ms82494 successfully extracts userId and crumb, but Yahoo not happy:
{'AAPL': 'Invalid Crumb'}
Not sure if a problem with my specific account, or with code