Conversation
vision/google/cloud/vision/_rest.py
Outdated
| @@ -0,0 +1,91 @@ | |||
| # Copyright 2016 Google Inc. | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
vision/google/cloud/vision/_rest.py
Outdated
| from google.cloud.vision.feature import Feature | ||
|
|
||
|
|
||
| class _RESTVisionAPI(object): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
This comment was marked as spam.
Sorry, something went wrong.
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.
This comment was marked as spam.
Sorry, something went wrong.
vision/google/cloud/vision/_rest.py
Outdated
| return response['responses'][0] | ||
|
|
||
|
|
||
| class VisionRequest(object): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
This comment was marked as spam.
Sorry, something went wrong.
vision/google/cloud/vision/client.py
Outdated
| source_uri=source_uri) | ||
|
|
||
| @property | ||
| def vision_api(self): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
This comment was marked as spam.
Sorry, something went wrong.
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.
This comment was marked as spam.
Sorry, something went wrong.
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.
This comment was marked as spam.
Sorry, something went wrong.
vision/unit_tests/test_client.py
Outdated
|
|
||
| class MockVisionAPI(object): | ||
| def annotate(self): | ||
| return True |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@dhermes is this all set? |
|
Yes, though it seems the rebase of #2870 into this would be easier than the other way around. WDYT? |
23fd960 to
fb6f7f8
Compare
|
Luckily #2874 won't conflict here |
fb6f7f8 to
74e537b
Compare
|
Rebased and squashed. Will merge once build passes. |
|
SGTM |
…st-client Separate HTTP client.
Towards #2753 for adding GAPIC support.
Separates out the REST client in preparation to add the GAPIC client alongside.