Skip to content

Commit a65f754

Browse files
committed
Changing vision Connection to only accept client.
1 parent a32a022 commit a65f754

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

vision/google/cloud/vision/client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@ class Client(ClientWithProject):
5555
falls back to the ``GOOGLE_CLOUD_DISABLE_GRPC`` environment
5656
variable
5757
"""
58+
59+
SCOPE = ('https://www.googleapis.com/auth/cloud-platform',)
60+
"""The scopes required for authenticating as a Cloud Vision consumer."""
61+
5862
_vision_api_internal = None
5963

6064
def __init__(self, project=None, credentials=None, http=None,
6165
use_gax=None):
6266
super(Client, self).__init__(
6367
project=project, credentials=credentials, http=http)
64-
self._connection = Connection(
65-
credentials=self._credentials, http=self._http)
68+
self._connection = Connection(self)
6669
if use_gax is None:
6770
self._use_gax = _USE_GAX
6871
else:

vision/google/cloud/vision/connection.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,3 @@ class Connection(_http.JSONConnection):
4242

4343
API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
4444
"""A template for the URL of a particular API call."""
45-
46-
SCOPE = ('https://www.googleapis.com/auth/cloud-platform',)
47-
"""The scopes required for authenticating as a Cloud Vision consumer."""

vision/unit_tests/test_connection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ def _make_one(self, *args, **kw):
2626
return self._get_target_class()(*args, **kw)
2727

2828
def test_default_url(self):
29-
creds = object()
30-
conn = self._make_one(creds)
31-
self.assertEqual(conn.credentials, creds)
29+
client = object()
30+
conn = self._make_one(client)
31+
self.assertEqual(conn._client, client)

0 commit comments

Comments
 (0)