Comments (6)
Ok thank you very much
from yahoofinanceapi.
@tosatoandrea now you must pass a "User agent" header in the request for crumb, similarly to how you make a request for cookies
from yahoofinanceapi.
Ok thank you, where exactly I can pass User Agent header?
I use only this code:
`try
{
// You should be able to query data from various markets including US, HK, TW
// The startTime & endTime here defaults to EST timezone
var history = await Yahoo.GetHistoricalAsync("SWDA", new DateTime(2023, 1, 1), new DateTime(2023, 7, 7), Period.Monthly);
foreach (var candle in history)
{
string line = $"DateTime: {candle.DateTime}, Open: {candle.Open}, High: {candle.High}, Low: {candle.Low}, Close: {candle.Close}, Volume: {candle.Volume}, AdjustedClose: {candle.AdjustedClose}";
textBox1.AppendText(Environment.NewLine + line);
}
riuscito = true;
}
catch (Exception ex)
{
textBox1.AppendText(Environment.NewLine + ex.Message);
}`
Thank you
from yahoofinanceapi.
@tosatoandrea the problem is in the library itself. So you should fork the source and modify method "InitAsync" in "YahooSession" class, The request for crumb should look like this:
_crumb = await "https://query1.finance.yahoo.com/v1/test/getcrumb"
.WithHeader(userAgentKey, userAgentValue)
.WithHeader("Accept", acceptHeader)
.WithCookie(_cookie.Name, _cookie.Value)
.GetAsync(token)
.ReceiveString();
Variables userAgentKey and userAgentValue are already defined in this method. The "Accept" header is not necessary AFAIK
from yahoofinanceapi.
Could someone with the authorization and knowledge update the package to a new version 2.3.0 or something, please?
Thanks!
from yahoofinanceapi.
I've prepared PR #60
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
- Failing with Status code 502 since Dec 4? HOT 14
- Flurl.Http dependencies issues HOT 1
- Call failed with status code 500 HOT 1
- FlurlHttpException with StatusCode: 429, ReasonPhrase: 'Too Many Requests' HOT 10
- 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.