GeezerVison is showing github.com — make_exception fails when json.loads fails · Issue #626 · googleapis/google-cloud-python
make_exception fails when json.loads fails #626Activityadded this to the This milestone has been deleted milestone on Feb 12, 2015dhermes commented on Feb 12, 2015 ContributorAuthor More actions @pdknsk Can you execute this code and give the output:
from gcloud import datastore
from gcloud.datastore import _datastore_v1_pb2 as datastore_pb
datastore.set_defaults()
# Create whatever entity you used with datastore.put([...]) in your
# stacktrace
batch = datastore.Batch()
batch.put(entity)
request_pb = datastore_pb.CommitRequest()
request_pb.mode = datastore_pb.CommitRequest.NON_TRANSACTIONAL
request_pb.mutation.CopyFrom(batch.mutation)
data = request_pb.SerializeToString()
headers = {
'Content-Type': 'application/x-protobuf',
'Content-Length': str(len(data)),
'User-Agent': 'gcloud/0.4.0-bug-test',
}
api_url = batch.connection.build_api_url(
dataset_id=batch.dataset_id, method='commit')
new_headers, content = batch.connection.http.request(
uri=api_url, method='POST', headers=headers, body=data)
print 'new_headers:'
print new_headers
print 'content:'
print contentdhermes commented on Feb 12, 2015 ContributorAuthor More actions Either that or you could just provide the could you used to create the entity that caused the failure and I can handle from there. pdknsk commented on Feb 12, 2015 >>> print new_headers
{'status': '400', 'alternate-protocol': '443:quic,p=0.08', 'content-length': '24', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'transfer-encoding': 'chunked', 'expires': 'Thu, 12 Feb 2015 23:42:34 GMT', 'vary': 'Origin, X-Origin', 'server': 'GSE', '-content-encoding': 'gzip', 'cache-control': 'private, max-age=0', 'date': 'Thu, 12 Feb 2015 23:42:34 GMT', 'x-frame-options': 'SAMEORIGIN', 'content-type': 'text/html; charset=UTF-8'}
>>> print content
Entity value is indexed.dhermes commented on Feb 12, 2015 ContributorAuthor More actions OK that's simple to fix.
Thanks. added a commit that references this issue on Feb 13, 2015This issue will close once commit c3e1351 is merged into the 'master' branch.c3e1351 tseaver commented on Feb 13, 2015 I sure don't know why the backend wouldn't return JSON for its errors (or at least document the error response format). dhermes commented on Feb 13, 2015 ContributorAuthor More actions Datastore is an RPC service. One might expect it to return proto messages as errors, but not JSON. tseaver commented on Feb 13, 2015 Documenting what it returns (status codes, body format) is more important than the specific format.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|