FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Separate HTTP client. by daspecster · Pull Request #2845 · googleapis/google-cloud-python · GitHub

Separate HTTP client. - #2845

Merged
daspecster merged 1 commit into
googleapis:masterfrom
daspecster:vision-separate-rest-client
Dec 15, 2016
Merged

Separate HTTP client.#2845
daspecster merged 1 commit into
googleapis:masterfrom
daspecster:vision-separate-rest-client

Conversation

Copy link
Copy Markdown
Contributor

Towards #2753 for adding GAPIC support.

Separates out the REST client in preparation to add the GAPIC client alongside.

daspecster added the api: vision Issues related to the Cloud Vision API. label Dec 8, 2016
daspecster requested review from dhermes and tseaver December 8, 2016 21:08
googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 8, 2016
Comment thread vision/google/cloud/vision/_rest.py Outdated
@@ -0,0 +1,91 @@
# Copyright 2016 Google Inc.

This comment was marked as spam.

Comment thread vision/google/cloud/vision/_rest.py Outdated
from google.cloud.vision.feature import Feature


class _RESTVisionAPI(object):

This comment was marked as spam.

Comment thread vision/google/cloud/vision/_rest.py Outdated
# See the License for the specific language governing permissions and
# limitations under the License.

"""REST Client for interacting with the Google Cloud Vision API."""

This comment was marked as spam.

Comment thread vision/google/cloud/vision/_rest.py Outdated
if isinstance(features, list):
self._features.extend(features)
elif isinstance(features, Feature):
self._features.append(features)

This comment was marked as spam.

Comment thread vision/google/cloud/vision/_rest.py Outdated
return response['responses'][0]


class VisionRequest(object):

This comment was marked as spam.

Comment thread vision/google/cloud/vision/_rest.py Outdated
response = self._connection.api_request(
method='POST', path='/images:annotate', data=data)

return response['responses'][0]

This comment was marked as spam.

Comment thread vision/google/cloud/vision/client.py Outdated
source_uri=source_uri)

@property
def vision_api(self):

This comment was marked as spam.

tseaver changed the title Separate REST client. Separate HTTP client. Dec 9, 2016
Comment thread vision/google/cloud/vision/_http.py Outdated
features = [features]

feature_check = (isinstance(feature, Feature) for feature in features)
if not isinstance(features, list) or not any(feature_check):

This comment was marked as spam.

Comment thread vision/google/cloud/vision/_http.py Outdated

return {
'image': image.as_dict(),
'features': [feature.as_dict() for feature in features]

This comment was marked as spam.

Comment thread vision/unit_tests/test__http.py Outdated
from google.cloud.vision.image import Image

credentials = _make_credentials()
client = Client(project=PROJECT, credentials=credentials)

This comment was marked as spam.

Comment thread vision/unit_tests/test_client.py Outdated

class MockVisionAPI(object):
def annotate(self):
return True

This comment was marked as spam.

Copy link
Copy Markdown
Contributor Author

@dhermes is this all set?

dhermes commented Dec 15, 2016

Copy link
Copy Markdown
Contributor

Yes, though it seems the rebase of #2870 into this would be easier than the other way around. WDYT?

Copy link
Copy Markdown
Contributor Author

Sure, I can wait for #2870. I'll squash this for now and merge once #2870 and probably #2874 are merged to master.

daspecster force-pushed the vision-separate-rest-client branch from 23fd960 to fb6f7f8 Compare December 15, 2016 20:02

dhermes commented Dec 15, 2016

Copy link
Copy Markdown
Contributor

Luckily #2874 won't conflict here

Copy link
Copy Markdown
Contributor Author

@dhermes yeah I just looked through #2874. SGTM! Will merge after #2870.

daspecster force-pushed the vision-separate-rest-client branch from fb6f7f8 to 74e537b Compare December 15, 2016 20:33

Copy link
Copy Markdown
Contributor Author

Rebased and squashed. Will merge once build passes.

dhermes commented Dec 15, 2016

Copy link
Copy Markdown
Contributor

SGTM

daspecster merged commit f4c3025 into googleapis:master Dec 15, 2016
daspecster deleted the vision-separate-rest-client branch December 15, 2016 20:56
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
This file contains hidden or 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: vision Issues related to the Cloud Vision API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL