雅虎财经 API 问题
Yahoo Finance API Problems
几天前我的代码运行良好,但自周五以来,我一直收到以下错误:
File "C:\Python27\Lib\urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Server Error
我所做的只是从 API 访问历史数据。还有其他人有这个问题吗?问题实际上出在雅虎服务器上吗?会不会是我发送的请求太多了(要求100只股票的历史数据)?
我也遇到了同样的问题。我正在使用这个查询:
https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quote%20where%20symbol%20in%20(%22APPL%22)&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=
我正在使用
> Try
>
> objWebRequest = CType(System.Net.WebRequest.Create(strScrapeString),
> System.Net.HttpWebRequest)
> objWebRequest.KeepAlive = False
> objWebRequest.Method = "GET"
> **objWebResponse = CType(objWebRequest.GetResponse(), System.Net.HttpWebResponse)** *(this is where it fails on debug)*
>
>
> ...
>
> objWebResponse.Close()
>
>
> Return strStockPrice
>
> Catch ex As Exception
> strResults = strResults + "<br/>" + "**ERROR**" + strSymbol + " Yahoo data not available. Exception Error Message : " +
> ex.Message.ToString()
> End Try
我可以看到我得到了
远程服务器返回错误:(500)内部服务器错误
在某些股票上,但并不总是相同的股票。我一次获得大约 40 只股票的股价。
Yahoo Finance 对此查询有每小时 2000 个请求的限制,如果超过这个限制,它应该会出现 403 错误,所以我认为过度使用不是 500 错误的原因。我在 objWebRequest.GetResponse 附近的代码中使用 Try, Catch。
几天前我的代码运行良好,但自周五以来,我一直收到以下错误:
File "C:\Python27\Lib\urllib2.py", line 527, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Server Error
我所做的只是从 API 访问历史数据。还有其他人有这个问题吗?问题实际上出在雅虎服务器上吗?会不会是我发送的请求太多了(要求100只股票的历史数据)?
我也遇到了同样的问题。我正在使用这个查询:
https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quote%20where%20symbol%20in%20(%22APPL%22)&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=
我正在使用
> Try
>
> objWebRequest = CType(System.Net.WebRequest.Create(strScrapeString),
> System.Net.HttpWebRequest)
> objWebRequest.KeepAlive = False
> objWebRequest.Method = "GET"
> **objWebResponse = CType(objWebRequest.GetResponse(), System.Net.HttpWebResponse)** *(this is where it fails on debug)*
>
>
> ...
>
> objWebResponse.Close()
>
>
> Return strStockPrice
>
> Catch ex As Exception
> strResults = strResults + "<br/>" + "**ERROR**" + strSymbol + " Yahoo data not available. Exception Error Message : " +
> ex.Message.ToString()
> End Try
我可以看到我得到了 远程服务器返回错误:(500)内部服务器错误 在某些股票上,但并不总是相同的股票。我一次获得大约 40 只股票的股价。 Yahoo Finance 对此查询有每小时 2000 个请求的限制,如果超过这个限制,它应该会出现 403 错误,所以我认为过度使用不是 500 错误的原因。我在 objWebRequest.GetResponse 附近的代码中使用 Try, Catch。