Skip to content

Conversation

lukesneeringer
Copy link
Contributor

@daspecster Would you please take a longer look at this one? I found the "two clients" thing really confusing and am not sure I did this correctly.

In particular, I am pretty sure the existing code threw away the credentials argument when being used with GAX. (Not sure how anyone would successfully set any of the other arguments, either.) I updated this and added a test for it.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 22, 2017
@lukesneeringer lukesneeringer mentioned this pull request Feb 22, 2017
7 tasks
@daspecster
Copy link
Contributor

Taking a look now.

:param client: Instance of ``Client`` object.
:type kwargs: dict
:param kwargs: Additional keyword arguments are sent to the GAPIC client.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

if self._use_gax:
self._vision_api_internal = _GAPICVisionAPI(self)
self._vision_api_internal = _GAPICVisionAPI(self,
credentials=None)

This comment was marked as spam.

from google.cloud.gapic.vision.v1.image_annotator_client import (
ImageAnnotatorClient)

from .test_client import _make_credentials

This comment was marked as spam.

This comment was marked as spam.


# Create the GAX client.
credentials = _make_credentials()
self._make_one(client=object(), credentials=credentials)

This comment was marked as spam.

# Assert that the GAPIC constructor was called once, and
# that the credentials were sent.
iac.assert_called_once()
self.assertIs(iac.mock_calls[0][2]['credentials'], credentials)

This comment was marked as spam.

This comment was marked as spam.

# that lib_name and lib_version were sent.
iac.assert_called_once()
self.assertEqual(iac.mock_calls[0][2]['lib_name'], 'gccl')
self.assertEqual(iac.mock_calls[0][2]['lib_version'], __version__)

This comment was marked as spam.

self._client = client
self._annotator_client = image_annotator_client.ImageAnnotatorClient()
self._annotator_client = image_annotator_client.ImageAnnotatorClient(
credentials=credentials, lib_name='gccl', lib_version=__version__)

This comment was marked as spam.

@lukesneeringer
Copy link
Contributor Author

@daspecster Please verify now. (Also, obviously, waiting on tests.)

instance.
:rtype: :class:`~google.cloud.grpc.vision.v1.image_annotator_pb2.Feature`
:rtype: :class:`~google.cloudvision.v1.image_annotator_pb2.Feature`

This comment was marked as spam.

if self._use_gax:
self._vision_api_internal = _GAPICVisionAPI(self)
self._vision_api_internal = _GAPICVisionAPI(
self, credentials=None)

This comment was marked as spam.

This comment was marked as spam.

"""Factory: construct an instance of ``Annotations`` from protobuf.
:type response: :class:`~google.cloud.grpc.vision.v1.\
:type response: :class:`~google.cloudvision.v1.\

This comment was marked as spam.

This comment was marked as spam.

@daspecster
Copy link
Contributor

Pending travis/circle this LGTM. I would recommend running the system tests as well if you haven't yet.

@lukesneeringer
Copy link
Contributor Author

The Travis errors suggest the credentials are not being passed correctly.


# Create the GAX client.
credentials = _make_credentials()
client = Client(credentials=credentials)

This comment was marked as spam.

This comment was marked as spam.

@daspecster
Copy link
Contributor

@lukesneeringer cool looks like that worked. Just a lint issue now.

@lukesneeringer lukesneeringer merged commit c525b44 into googleapis:master Feb 23, 2017
@lukesneeringer lukesneeringer deleted the gccl-vision branch February 23, 2017 01:46
richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
parthea pushed a commit that referenced this pull request Oct 21, 2023
parthea pushed a commit that referenced this pull request Aug 21, 2025
…0 [(#3050)](GoogleCloudPlatform/python-docs-samples#3050)

* chore(deps): update dependency google-cloud-bigquery-storage to v0.8.0

* chore(deps): update pandas-gbq

* chore(deps): update ipython

* chore: update requirements.txt

* chore: it is spelled version.

* chore(deps): split pandas version

* chore(deps): split pandas version

Co-authored-by: Christopher Wilcox <crwilcox@google.com>
Co-authored-by: Leah Cole <coleleah@google.com>
parthea pushed a commit that referenced this pull request Sep 16, 2025
…0 [(#3050)](GoogleCloudPlatform/python-docs-samples#3050)

* chore(deps): update dependency google-cloud-bigquery-storage to v0.8.0

* chore(deps): update pandas-gbq

* chore(deps): update ipython

* chore: update requirements.txt

* chore: it is spelled version.

* chore(deps): split pandas version

* chore(deps): split pandas version

Co-authored-by: Christopher Wilcox <crwilcox@google.com>
Co-authored-by: Leah Cole <coleleah@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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