我在GAE上使用python。下面是一个示例代码:
try:
response = urlfetch.fetch(url, headers=headers)
except Exception, E:
logging.error("urlfetch failed: %s: %s" %(E, E.__dict__))对于一些请求,我得到了这样的结果:
urlfetch failed: '_URLFetchResult' object has no attribute 'reason': {}早在2011年,就有一个类似的问题并没有真正解决我的问题:Why am I getting an AttributeError when trying to print out
有人知道什么会导致这个错误吗?我甚至尝试向请求添加超时,但没有更改任何内容。
发布于 2015-10-24 10:32:12
试试这个:
try:
fetch_response = urlfetch.fetch(url, headers=headers)
except:
logging.error("urlfetch failed. Status code: %d" % (fetch_response.status_code))
if fetch_response.status_code == 200:
logging.error("fetch_response.content:")
logging.error(fetch_response.content)https://stackoverflow.com/questions/33271848
复制相似问题