Comments (10)
Can confirm the same. Possible rate limits on the part of Yahoo, but why all of a sudden.
from yahoofinanceapi.
Rate limit? Definitely not, as the exemption was thrown immediately after the first request.
from yahoofinanceapi.
I am hitting the same too.
from yahoofinanceapi.
I have found a way. Tip came from here:
https://stackoverflow.com/questions/78111453/yahoo-finance-api-file-get-contents-429-too-many-requests
Do the same thing as in InitAsync() when we get the crumb:
https://github.com/karlwancl/YahooFinanceApi/blob/master/YahooFinanceApi/YahooSession.cs
Which was:
const string userAgentKey = "User-Agent";
const string userAgentValue = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36";
...
.WithHeader(userAgentKey, userAgentValue)
.GetAsync()
So, both in Historical.cs and in Quote.cs, put this line before the GetAsync()
.WithHeader("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36")
.GetAsync(...
Works for me at the moment. (from the UK).
Somebody could clean the quick-and-dirty solution and create a PR to fix it properly in the repo.
One proper solution is to create the string userAgentKey/userAgentValue as data member fields somewhere, and all 3 GetAsync() could use that.
from yahoofinanceapi.
Feeds work again now, even without the change proposed above!
from yahoofinanceapi.
Thx for checking.
Maybe it works for you now without the proposed changes, but you might use it from a different country (USA?). I am from London.
And I just checked it again right now. 5 minutes ago.
For me, this line is still needed at this moment. Otherwise I get the Furl exception.
.WithHeader("User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36")
Let's hear the experiences of others.
from yahoofinanceapi.
I am in Germany. It started failing last night, but it worked again about an hour ago.
from yahoofinanceapi.
I made code changes as suggested. Please try it.
It works from USA today with and without the changes.
However, there are random 401 errors are occurring during the testing.
from yahoofinanceapi.
Funny enough. 30min after my previous post (that I double-checked), now in the UK, I get the same as you:
It started working with or without the changes. Hmmm.
I also have the random 'Call failed with status code 401 (Unauthorized)' when we get the Crumb.
But usually, it works after the second try.
Thx for sharing the experience.
from yahoofinanceapi.
In AU I too get some random 401
Call failed with status code 401 (Unauthorized): GET https://query1.finance.yahoo.com/v1/test/getcrumb
from yahoofinanceapi.
Related Issues (20)
- Dividend Date HOT 1
- Exchange rate? HOT 1
- DividendDate issue HOT 1
- Empty dictionary? HOT 2
- stock split before after data is always zero HOT 4
- Can I retrieve historical data by hour?
- Exception: Failure to create client HOT 27
- Is 3.0.0-beta3 the final version?
- v7 API now breaks with "code":"Unauthorized","description":"Invalid Cookie" HOT 16
- Failed with status code 403 on Android HOT 1
- Premarket data HOT 1
- Error Too Many Requests HOT 6
- Failing with Status code 502 since Dec 4? HOT 14
- Flurl.Http dependencies issues HOT 1
- Call failed with status code 500 HOT 1
- Error code 500 (Cannot find server.): GET https://fc.yahoo.com HOT 2
- Stock split question HOT 1
- Can't install nuget: Cycle Detected
- Flurl.Http.FlurlHttpException: 'Call failed with status code 429 (Too Many Requests): HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yahoofinanceapi.