GAE - AppEngine - DeadlineExceededError:在等待来自URL的HTTP响应时超出了截止日期: [英] GAE - AppEngine - DeadlineExceededError: Deadline exceeded while waiting for HTTP response from URL:

查看:115
本文介绍了GAE - AppEngine - DeadlineExceededError:在等待来自URL的HTTP响应时超出了截止日期:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台Google AppEngine应用程序,可以在我的本地机器上运行。该应用程序发布图像(从网址)到我的脸谱墙。但是,当我将它部署到Google的服务器时,我得到
的一个错误:

I have a Google AppEngine application which runs great on my local machine. The app posts a image (from a url) to my facebook wall. However, when I deploy it to Google's servers, I get an error:

DeadlineExceededError: Deadline exceeded while waiting for HTTP response from URL: 

违规代码是:

The offending code is:

facebook_access_token = facebook_info['access_token']

facebook_post_url = 'https://graph.facebook.com/me/photos?access_token=%s&url=%s&name=%s&method=post' % (facebook_access_token, url, caption)
facebook_post_url = facebook_post_url.replace(" ", "+");
facebook_result = urlfetch.fetch(facebook_post_url)

if facebook_result.status_code == 200:
  facebook_result_object = json.loads(facebook_result.content) 
  output_ids['facebook'] = facebook_result_object['id']
else:
  output_ids['facebook'] = ''

Ans完整的错误追踪:

Ans the full error trace is:

Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 710, in __call__
    handler.get(*groups)
  File "/base/data/home/apps/s~digibackapi/1.362663258877230387/main.py", line 512, in get
    facebook_result = urlfetch.fetch(facebook_post_url)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/urlfetch.py", line 266, in fetch
    return rpc.get_result()
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 604, in get_result
    return self.__get_result_hook(self)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/urlfetch.py", line 404, in _get_fetch_result
    'Deadline exceeded while waiting for HTTP response from URL: ' + url)
DeadlineExceededError: Deadline exceeded while waiting for HTTP response from URL: https://graph.facebook.com/me/photos?access_token=<ACCESS_TOKEN>&url=http://digiback.cc/ej7&name=Trees&method=post

代码对我来说看起来很稳固,并且在我的本地机器上工作正常。它可能与超时无关吗?当我在浏览器中尝试 facebook_post_url 时,它会立即返回。

Again, the code looks solid to me, and it works ok on my local machine. Could it have something t do with timeouts? When I try the facebook_post_url in a browser, it returns instantly.

有没有人有任何想法?

Does anyone have any ideas? I am ata complete loss here.

非常感谢!

推荐答案

尝试将urlfetch的截止日期设置为30秒或更长时间(具体取决于您是从任务处理程序还是请求处理程序中调用urlfetch)

Try setting the deadline for urlfetch to 30seconds or more(depending on whether you're calling urlfetch from within a task handler or request handler)

有关urlfetch的更多信息: Url提取文档

More info about urlfetch:Url Fetch Docs

这篇关于GAE - AppEngine - DeadlineExceededError:在等待来自URL的HTTP响应时超出了截止日期:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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