Skip to content

Conversation

dhermes
Copy link
Contributor

@dhermes dhermes commented Feb 17, 2017

This leaves _http.py closer to what it should look like, but not all the way there (it is doing some of the transport choosing that should be done in client.py)

@dhermes dhermes added api: datastore Issues related to the Datastore API. hygiene labels Feb 17, 2017
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 17, 2017
@@ -0,0 +1,197 @@
# Copyright 2014 Google Inc.

This comment was marked as spam.

This comment was marked as spam.


@contextlib.contextmanager
def _grpc_catch_rendezvous():
"""Re-map gRPC exceptions that happen in context.

This comment was marked as spam.

This comment was marked as spam.

@dhermes
Copy link
Contributor Author

dhermes commented Feb 17, 2017

@daspecster I folded those changes into the original commit (since they were super tiny)

@daspecster
Copy link
Contributor

SGTM! Thanks! I know they were nitpicky.

The rest LGTM but I feel like someone else should take a crack at it.

try:
from grpc import StatusCode
from google.cloud.grpc.datastore.v1 import datastore_pb2_grpc
from google.cloud.datastore._gax import _DatastoreAPIOverGRPC

This comment was marked as spam.

This comment was marked as spam.

from grpc import StatusCode
from google.cloud.grpc.datastore.v1 import datastore_pb2_grpc
from google.cloud.datastore._gax import _DatastoreAPIOverGRPC
_HAVE_GRPC = True

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

yield
except exceptions.GrpcRendezvous as exc:
error_code = exc.code()
error_class = _GRPC_ERROR_MAPPING.get(error_code)

This comment was marked as spam.

This comment was marked as spam.

from grpc import StatusCode
from google.cloud.grpc.datastore.v1 import datastore_pb2_grpc
from google.cloud.datastore._gax import _DatastoreAPIOverGRPC
_HAVE_GRPC = True

This comment was marked as spam.

@dhermes dhermes merged commit 0cb9e53 into googleapis:master Feb 22, 2017
@dhermes dhermes deleted the give-datastore-gax branch February 22, 2017 00:48
richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
Moving datastore GAX/gRPC helpers out of _http and into dedicated module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the Datastore API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants