Last active
August 29, 2015 14:10
-
-
Save dhermes/9a5ecf4579489c6cb6f4 to your computer and use it in GitHub Desktop.
endpoints-proto-datastore issue 114
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
application: my-api | |
version: 1 | |
runtime: python27 | |
threadsafe: true | |
api_version: 1 | |
handlers: | |
# Endpoints handler | |
- url: /_ah/spi/.* | |
script: main.application | |
libraries: | |
# Needed for endpoints/users_id_token.py. | |
- name: pycrypto | |
version: "2.6" | |
- name: endpoints | |
version: 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST http://localhost:8080/_ah/api/sbapi/v1/report | |
Content-Type: application/json | |
X-JavaScript-User-Agent: Google APIs Explorer | |
{ | |
"account": "8239472394", | |
"compare": true, | |
"name": "Testreport", | |
"modules": [ | |
{ | |
"details": "{'data':'test'}", | |
"module_type": "twitter_report" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
503 Service Unavailable | |
Content-Length: 196 | |
Content-Type: application/json | |
Date: Wed, 26 Nov 2014 23:07:19 GMT | |
Server: Development/2.0 | |
{ | |
"error": { | |
"code": 503, | |
"errors": [ | |
{ | |
"domain": "global", | |
"message": "Internal Server Error", | |
"reason": "backendError" | |
} | |
], | |
"message": "Internal Server Error" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/home/dhermes/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0/protorpc/wsgi/service.py", line 181, in protorpc_service_app | |
response = method(instance, request) | |
File "/home/dhermes/google-cloud-sdk/platform/google_appengine/lib/endpoints-1.0/endpoints/api_config.py", line 1329, in invoke_remote | |
return remote_method(service_instance, request) | |
File "/home/dhermes/google-cloud-sdk/platform/google_appengine/lib/protorpc-1.0/protorpc/remote.py", line 412, in invoke_remote_method | |
response = method(service_instance, request) | |
File "/home/dhermes/endpoints-proto-datastore/examples/basic_pickle/endpoints_proto_datastore/ndb/model.py", line 1416, in EntityToRequestMethod | |
request = cls.FromMessage(request) | |
File "/home/dhermes/endpoints-proto-datastore/examples/basic_pickle/endpoints_proto_datastore/ndb/model.py", line 1238, in FromMessage | |
to_add = [FromValue(value_property, element) for element in value] | |
File "/home/dhermes/endpoints-proto-datastore/examples/basic_pickle/endpoints_proto_datastore/ndb/model.py", line 145, in FromValue | |
return modelclass.FromMessage(value) | |
File "/home/dhermes/endpoints-proto-datastore/examples/basic_pickle/endpoints_proto_datastore/ndb/model.py", line 1240, in FromMessage | |
to_add = FromValue(value_property, value) | |
File "/home/dhermes/endpoints-proto-datastore/examples/basic_pickle/endpoints_proto_datastore/ndb/model.py", line 152, in FromValue | |
return pickle.loads(value) | |
File "/usr/lib/python2.7/pickle.py", line 1382, in loads | |
return Unpickler(file).load() | |
File "/usr/lib/python2.7/pickle.py", line 858, in load | |
dispatch[key](self) | |
File "/usr/lib/python2.7/pickle.py", line 1203, in load_setitems | |
mark = self.marker() | |
File "/usr/lib/python2.7/pickle.py", line 874, in marker | |
while stack[k] is not mark: k = k-1 | |
IndexError: list index out of range |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/GoogleCloudPlatform/endpoints-proto-datastore/issues/114 | |
import endpoints | |
from google.appengine.ext import ndb | |
from protorpc import remote | |
from endpoints_proto_datastore.ndb import EndpointsModel | |
class Module(EndpointsModel): | |
module_type = ndb.StringProperty(required=True) | |
details = ndb.PickleProperty() | |
class Report(EndpointsModel): | |
account = ndb.StringProperty(required=True) | |
compare = ndb.BooleanProperty(required=True) | |
name = ndb.StringProperty(required=True) | |
modules = ndb.StructuredProperty(Module, repeated=True) | |
@endpoints.api(name='sbapi', version='v1', description='SB API') | |
class SBApi(remote.Service): | |
@Report.method(path='report', http_method='POST', name='report.insert') | |
def ReportInsert(self, report): | |
report.put() | |
return report | |
application = endpoints.api_server([SBApi], restricted=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment