-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intermittent HTTP 401 returned from Yahoo API #206
Comments
When I tried to load https://query1.finance.yahoo.com/v7/finance/quote?symbols=ORCL in the Browser, it mostly works, but sometimes I get
So it seems this may be some problem at Yahoo itself. |
Hi! the same error to me, code":"Unauthorized" Something change on Yahoo? |
@centic9 @emidesy Same here. Apparently you need to pass the crumb as an argument now? If you go to https://query1.finance.yahoo.com/v1/test/getcrumb on a browser, you should get a string result. If you pass it to the URL, you should be able to get the info like so:
However, this is not working in my Android App. I've debugged the app a little and Cookie and Crumb are returning empty because the
I'm assuming something changed related to how the API is accessed and the content returned from |
I have the api as a dependency in my Maven project. How can I modify the QuotesRequest class as you have above? I do not know where to find or how to modify the files? |
I have the same problem: Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: https://query1.finance.yahoo.com/v7/finance/quote?symbols=..... |
I added params.put("crumb", CrumbManager.getCrumb()); I still got the same error. "crumb=" is added to URL. Should not this crumb parameter be empty? java.io.IOException: Server returned HTTP response code: 401 for URL: https://query1.finance.yahoo.com/v7/finance/quote?symbols=CSOL-EUR%2CSOL-USD&crumb= |
It could depend on the country that you are in whether or not you need the cookie. I'm in the US. |
The problem is that crumb is not generated in the function. If I manually use URL https://query1.finance.yahoo.com/v1/test/getcrumb in browser, than I got a crumb. The code below does not return crumb. It is always empty.
|
I tried also with chatGPT code and crumb is not returned
|
use https://query1.finance.yahoo.com/v6/finance/quote?symbols=... it works for me....v7 -> v6 |
Hi, I tried to use windscribe vpn. I found out that it did not work from Europe(Vienna, Oslo, Zagreb) but it worked from Tokyo and US. Then I tried also Frankfurt Germany and it worked. After that also other EU cities worked (Vienna, Oslo, Zagreb). Change in QuotesRequest works for me. Thanks |
This means the following may be a workaround in the client-code without changes to the yahoofinance-api code itself
At least it seems to make it work for me. |
I have the same problem - Crumb is indeed generated on the browser, but not in the app where the same URL is used. Like I've mentioned before, the patterns are not matched against the HTML the app receives, so scraping the crumb and cookie isn't working for me also.
Changing the URL does seem to work. Apparently that one hasn't changed how it's accessed and is working exactly as it was before (for now, anyway!) |
For me, the crumb is not null and adding it as a url parameter is sufficient. Don't need to go back to v6. |
I'm assuming that the content from which the crumb is extracted is regionalized then. I'm from Europe and the content from the base URL scrape does not get any pattern matches. Let's hope v6 doesn't suffer the same fate! |
Igot the same error today , I am using the API to get the ticker quote , how to ia add the crumb to my call ? stock = YahooFinance.get(stockArray[i]); |
It's not the first time something like this happens. It usually takes a couple of days for them to fix their backend |
changing url worked for me too. thanks. |
thanks that worked |
It seems the "v6" API was now shutdown by Yahoo, likely because everyone switched over from "v7" |
@centic9 is there any fix available for the v7 of the API? |
It likely is the case. I get the "404" error for the v6.
|
please help me 进程已结束,退出代码0 |
@bufayadexiaotudou Not sure whether you read through this post or not. The URL no longer functions. |
It seems that here is a solution to get the crumb for e.g. EU countries, to use the v7 api again. issue: code of fix: |
I think you're spot on. |
I am getting this new error in my java spring boot application. |
Take reference from this code which which is working change the existing source code and create a jar , now application will work back to normal `import org.junit.Test; import java.io.BufferedReader; import static org.junit.Assert.assertEquals; /**
|
I've adapted the code to my use case, and I can confirm this solutions works (for now). Let's hope it stays that way this time. |
You need to use the v7 quotes query URL as the v6 one has been disabled. Looking at the the 3.17.0 code base you need to change the getResult() method in the abstract class QuotesRequest in package yahoofinance.quotes.query1v7 and append the crumb to the URL.
|
I tried by it gives me "" the CrumbManager.getCrumb() call... |
I'm in the US and there is no cookie value either. Not sure if having no cookie value effects quote history, etc.? But okay some questions:
Do you see a crumb value? If not this will be harder to fix. Thanks |
@code-monkey-101 where do the following packages come from? com.ib.client I am trying to integrate the project you mentioned into my own project, while maintaining a valid project structure.
|
That's the Interactive Brokers API. You don't need that. |
Thank you for the project structure recommendation, @code-monkey-101 ! I also do not see the following 3 classes in the screenshot -- Stock.java, -- however they are in the project on GitHub. If I include those within the yahoofinance package, then YahooFinance.java conflicts with the YahooFinance.class imported by Maven. Would you advise which location the above three classes should go? Thank you again |
I downgraded my Java to 1.8 and it works for me. This isn't a solution but it should be noted. |
Worked for me |
Hi am also facing same issue, have found any solution? |
I am calling the API at a frequency of 5 minutes for around 10 stocks, which worked fine for quite some time.
Since a few days, the Yahoo API still works, but sometimes fails with HTTP 401.
There have previously been issues with some cookies which lead to this error, e.g. #130
Is this a re-occurrence of this?
If the API now really would need authentication via a Yahoo-ID and OAuth it would fail always, not intermittently, so seems at least some similar issue.
Can I investigate this some more? Logging? Debugging?
Code:
Exception
The text was updated successfully, but these errors were encountered: