从 AppEngine 与外部 api 通信时出现 ApplicationError2 和 ApplicationError5

发布于 2025-01-03 00:19:45 字数 689 浏览 0 评论 0原文

我在 google app engine 上用 python27 构建了一个应用程序来与另一个服务 API 连接,一般来说一切都运行顺利。我时不时地收到以下两个错误之一

(<class 'google.appengine.api.remote_socket._remote_socket.error'>, error('An error occured while connecting to the server: ApplicationError: 2 ',), <traceback object at 0x11949c10>)

(<class 'httplib.HTTPException'>, HTTPException('ApplicationError: 5 ',), <traceback object at 0x113a5850>)

这些错误中的第一个(ApplicationError:2)我将其解释为与我通信的服务器部分发生的错误,但是我无法找到有关于此的任何细节以及我是否有责任/可以解决它的任何方式。

第二个错误 (ApplicationError: 5) 我发现了一些详细信息,它表明服务器与我的应用程序通信的时间太长 - 但是我将超时设置为 20 秒,它的失败速度比这要快得多。

如果有人可以提供链接或深入了解错误 - 特别是导致错误的原因以及可以采取哪些措施来修复它,我将非常感激。

I have built an application on google app engine, in python27 to connect with another services API and in general everything works smoothly. Every now and then I get one of the following two errors

(<class 'google.appengine.api.remote_socket._remote_socket.error'>, error('An error occured while connecting to the server: ApplicationError: 2 ',), <traceback object at 0x11949c10>)

(<class 'httplib.HTTPException'>, HTTPException('ApplicationError: 5 ',), <traceback object at 0x113a5850>)

The first of these errors (ApplicationError: 2) I interpret to be an error occurring on the part of the servers with which I am communicating, however I've not been able to find any detail on this and if there is any way I am responsible / can fix it.

The second of these errors (ApplicationError: 5) I've found some detail on and it suggests that the server took too long to communicate with my application - however I've set the timeout to be 20s and it fails considerably quicker than that.

If anyone could offer links or insight into the errors - specifically what causes the error and what can be done to fix it I'd very much appreciate it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天邊彩虹 2025-01-10 00:19:46

你开始在随意的对话和咒骂中使用“幂等”这个词:)

你唯一能做的就是再次尝试呼叫,并接受你的初始呼叫可能已经完成的事实,只是响应超时- 即,如果调用实际上执行了某些操作(例如创建客户订单),则在超时错误之后,您可能必须检查第一个请求是否成功,这样您就不会得到同一订单的多个副本。

希望这是有道理的。 FWIW,我们使用一些不友好的 API,对我们来说,大约 80% 的代码正在处理这种类型的 !@#$%。

You get to start using the word "idempotent" in casual conversations and curses :)

The only thing you can do is to try the call again, and accept the fact that your initial call may have gone through, only to time out on the response - i.e. if the call actually did something (create a customer order for example), after the timeout error you might have to check if the first request succeed so you don't end up with multiple copies of the same order.

Hope that makes sense. FWIW we work with some unfriendly API's and for us, about 80% of our code is dealing with exactly this sort of !@#$%.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文