使用 StackOverflow API 和 Visual Studio 2010
我已经下载了TheWorldsWorstStackOverflowClone。其中一个项目名为 TheWorldWorsts.ApiWrapper,它基本上是访问 API 的核心。有一个名为 ApiProxy.cs 的类,其中包含 API 调用的所有方法。这很好。
现在我想做的是尝试从这个 API 接口收集数据并将其存储在数据库中。我知道API调用的限制是每天10k。即:我希望能够每天自动调用 ApiProxy 类中的方法 10k 次。我该怎么做?
非自动方法是创建一个虚拟站点,当我每次访问该站点时,它都会执行所有这些过程,但这效率不高。看来我必须通过部署 Web 服务来编写某种调度程序,但这太复杂了......正如所解释的 此处。还有其他更简单的方法吗?
I have downloaded TheWorldsWorstStackOverflowClone. One of the project is called TheWorldWorsts.ApiWrapper, which basically is the core of accessing the API. There is a class called ApiProxy.cs, which has all the methods for the API call. This is good.
Now what I want to do is I am trying to collect data from this API interface and store it in a database. I know the limit to the API call is 10k per day. I.e: I want to be able to call the method in the ApiProxy class 10k times per day, done automatically. How can I do this?
The non-automatic way would be to create a dummy site where when every time I access the site it does all that process, but this not efficient. It seems that I have to write some kind of a scheduler by deploying a web service, but that is too complicated... as explained here. Any other simpler methods?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Windows 服务或桌面应用程序可能是比 Web 应用程序更好的解决方案。您不是在部署 Web 服务,而是使用代理类来使用 Web 服务,并且这不需要您拥有 Web 服务器或网站。
您可以使用 Web 应用程序在服务下载数据时控制和监视进度,但实际工作需要长时间运行,需要卸载到另一个进程或线程,以便您可以告诉用户发生了什么。
A Windows Service or Desktop App might be a better solution than a web application. You are not deploying a web service, you are consuming one using a proxy class, and this does not require you to have a web server or a web site.
You could use a web application to control and monitor progress as your service downloads data, but the actual work is long running and needs to be offloaded to another process or thread so you can tell the user whats going on.
看看这个
http://stacky.codeplex.com/
这看起来就是您所需要的,虽然我面临一些调试问题,但希望您能解决它。
Check out this one
http://stacky.codeplex.com/
This looks what you need, though I am facing some debugging issues, but hope you can figure it out.