与AppEngine的外部API进行通信时,ApplicationError2和ApplicationError5 [英] ApplicationError2 and ApplicationError5 when communicating with external api from AppEngine

查看:123
本文介绍了与AppEngine的外部API进行通信时,ApplicationError2和ApplicationError5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在谷歌应用程序引擎上构建了一个应用程序,在python27中与另一个服务API进行连接,并且一般情况下一切都可以顺利进行。我偶尔会发现以下两个错误之一:

 (< class'google.appengine.api.remote_socket._remote_socket ('连接到服务器时发生错误:ApplicationError:2'),< traceback object at 0x11949c10>)

(< class'httplib.HTTPException' > ;, HTTPException('ApplicationError:5',),< 0x113a5850处的追踪对象>)

这些错误中的第一个(ApplicationError:2)我解释为与我通信的服务器部分发生了错误,但是我一直无法找到任何细节,如果我有任何方法负责/可以修复它。



这些错误中的第二个(ApplicationError:5)我发现了一些细节,它表明服务器花了很长时间与我的应用程序 - 但是我已经将超时设置为20秒,并且失败的速度比这更快。



如果nyone可以提供错误的链接或洞察 - 具体是什么导致错误,以及可以做些什么来解决它我非常感谢它。

解决方案你可以在随便的谈话和诅咒中开始使用idempotent这个词:)

你可以做的唯一事情就是再次尝试呼叫,并且接受你的初始呼叫可能已经过去的事实,只是为了超时响应 - 即如果呼叫实际上做了某事(例如创建一个客户订单),在超时错误之后,你可能必须检查第一个请求成功,因此您不会收到同一订单的多个副本。



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

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.

解决方案

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 !@#$%.

这篇关于与AppEngine的外部API进行通信时,ApplicationError2和ApplicationError5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆