去AppEngine remote_api示例不起作用

时间:2014-05-07 01:10:34

标签: google-app-engine go

Go AppEngine样本是最新的吗?

我遇到问题让example/remote_api/datastore_info.go为我在localhost上运行的测试AppEngine工作。

我已经改变了client.PostForm:

resp, err := client.PostForm("https://www.google.com/accounts/ClientLogin", v)

为:

resp, err := client.PostForm("http://localhost:35058/_ah/remote_api", v)

(35058是启动时为api_server报告的端口)。

我已经尝试了1.9.3和最新的1.9.4版本。

api服务器报告:

ERROR    2014-05-06 20:57:56,378 api_server.py:215] Exception while handling 
Traceback (most recent call last):
  File "/root/go_appengine/google/appengine/tools/devappserver2/api_server.py", line 194, in _handle_POST
    request.ParseFromString(wsgi_input)
  File "/root/go_appengine/google/net/proto/ProtocolBuffer.py", line 88, in ParseFromString
    self.MergeFromString(s)
  File "/root/go_appengine/google/net/proto/ProtocolBuffer.py", line 95, in MergeFromString
    self.MergePartialFromString(s)
  File "/root/go_appengine/google/net/proto/ProtocolBuffer.py", line 109, in MergePartialFromString
    self.TryMerge(d)
  File "/root/go_appengine/google/appengine/ext/remote_api/remote_api_pb.py", line 210, in TryMerge
    d.skipData(tt)
  File "/root/go_appengine/google/net/proto/ProtocolBuffer.py", line 529, in skipData
    self.skipData(t)
  File "/root/go_appengine/google/net/proto/ProtocolBuffer.py", line 529, in skipData
    self.skipData(t)
  File "/root/go_appengine/google/net/proto/ProtocolBuffer.py", line 537, in skipData
    raise ProtocolBufferDecodeError, "corrupted"
ProtocolBufferDecodeError: corrupted

2 个答案:

答案 0 :(得分:0)

1.9.6中有一些错误修复;你可以试试最新的SDK吗?

答案 1 :(得分:0)

在我对开发服务器的任何调用中,我都遇到了同样的问题

Traceback (most recent call last):
  File "/home/mike/go_appengine/google/appengine/tools/devappserver2/api_server.py", line 238, in _handle_POST
    request.ParseFromString(wsgi_input)
  File "/home/mike/go_appengine/google/net/proto/ProtocolBuffer.py", line 140, in ParseFromString
    self.MergeFromString(s)
  File "/home/mike/go_appengine/google/net/proto/ProtocolBuffer.py", line 152, in MergeFromString
    self.MergePartialFromString(s)
  File "/home/mike/go_appengine/google/net/proto/ProtocolBuffer.py", line 168, in MergePartialFromString
    self.TryMerge(d)
  File "/home/mike/go_appengine/google/appengine/ext/remote_api/remote_api_pb.py", line 210, in TryMerge
    d.skipData(tt)
  File "/home/mike/go_appengine/google/net/proto/ProtocolBuffer.py", line 677, in skipData
    raise ProtocolBufferDecodeError, "corrupted"
ProtocolBufferDecodeError: corrupted

我去版本go1.4.2(appengine-1.9.24)linux / amd64

问题是我使用IP代替“API”而不是默认模块的IP

INFO     2015-08-13 19:42:03,901 devappserver2.py:763] Skipping SDK update check.
INFO     2015-08-13 19:42:03,947 api_server.py:205] Starting API server at: http://localhost:60852
INFO     2015-08-13 19:42:03,971 dispatcher.py:197] Starting module "default" running at: http://localhost:49333
INFO     2015-08-13 19:42:03,972 admin_server.py:118] Starting admin server at: http://localhost:8000

您必须使用模块主机/ por来调用go应用程序;我认为API ip适用于远程api。