App Engine “InvalidURLError: 无效请求URL”,尽管在浏览器中URL正常工作
我正在使用一个叫做App Engine的任务队列来查询AlchemyAPI。我把一段文本发送到任务队列中。每个任务队列的工作者会去查询AlchemyAPI,并处理返回的结果。
在处理了大约1500个结果后,我开始遇到一些无尽的错误,错误信息看起来像这样:
InvalidURLError: Invalid request URL: http://access.alchemyapi.com/calls/text/TextGetRankedNamedEntities?outputMode=json&apikey=xxxx&text=myverylongtexthere
让我感到困惑的是,如果我把那个 supposedly invalid 的网址直接复制粘贴到我的浏览器里,它却能正常工作!
这到底是什么原因导致的错误呢?
1 个回答
2
我想你的网址可能超过了2048个字符,因为里面有myverylongtexthere
这个很长的文本。
google.appengine.api.urlfetch_errors.InvalidURLError
Raised when the URL given is empty or invalid.
Only http: and https: URLs are allowed. The maximum URL length
allowed is 2048 characters. The login/pass portion is not
allowed. In deployed applications, only ports 80 and 443 for http
and https respectively are allowed.