Coder Social home page Coder Social logo

Comments (9)

BobMc98 avatar BobMc98 commented on May 27, 2024

Can confirm the same. Possible rate limits on the part of Yahoo, but why all of a sudden.

from yahoofinanceapi.

irigopou avatar irigopou commented on May 27, 2024

Rate limit? Definitely not, as the exemption was thrown immediately after the first request.

from yahoofinanceapi.

kamoco avatar kamoco commented on May 27, 2024

I am hitting the same too.

from yahoofinanceapi.

gyantal avatar gyantal commented on May 27, 2024

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.

irigopou avatar irigopou commented on May 27, 2024

Feeds work again now, even without the change proposed above!

from yahoofinanceapi.

gyantal avatar gyantal commented on May 27, 2024

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.

irigopou avatar irigopou commented on May 27, 2024

I am in Germany. It started failing last night, but it worked again about an hour ago.

from yahoofinanceapi.

sergemat avatar sergemat commented on May 27, 2024

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.

gyantal avatar gyantal commented on May 27, 2024

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.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.