I am currently using Google’s Finance API to pull stock information. (Yes I know it is deprecated and may be discontinued soon).
When I load the XML:
XDocument doc = XDocument.Load("http://www.google.com/ig/api?stock=ticker");
I am returning a 503 (probably due to to many requests in a given time period.
Is there anyway I can override the request headers sent to more or less mimic a user agent header from chrome?
The simplest approach is probably not to use the overload that takes a URL in that case. Instead, create a
WebRequestwhich has all the headers and any other customizations you want, get the response, and pass the response stream toXDocument.Load(Stream).