Skip to content

Commit

Permalink
Changing vision Connection to only accept client.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Jan 27, 2017
1 parent a32a022 commit a65f754
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
7 changes: 5 additions & 2 deletions vision/google/cloud/vision/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,17 @@ class Client(ClientWithProject):
falls back to the ``GOOGLE_CLOUD_DISABLE_GRPC`` environment
variable
"""

SCOPE = ('https://www.googleapis.com/auth/cloud-platform',)
"""The scopes required for authenticating as a Cloud Vision consumer."""

_vision_api_internal = None

def __init__(self, project=None, credentials=None, http=None,
use_gax=None):
super(Client, self).__init__(
project=project, credentials=credentials, http=http)
self._connection = Connection(
credentials=self._credentials, http=self._http)
self._connection = Connection(self)
if use_gax is None:
self._use_gax = _USE_GAX
else:
Expand Down
3 changes: 0 additions & 3 deletions vision/google/cloud/vision/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,3 @@ class Connection(_http.JSONConnection):

API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}'
"""A template for the URL of a particular API call."""

SCOPE = ('https://www.googleapis.com/auth/cloud-platform',)
"""The scopes required for authenticating as a Cloud Vision consumer."""
6 changes: 3 additions & 3 deletions vision/unit_tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ def _make_one(self, *args, **kw):
return self._get_target_class()(*args, **kw)

def test_default_url(self):
creds = object()
conn = self._make_one(creds)
self.assertEqual(conn.credentials, creds)
client = object()
conn = self._make_one(client)
self.assertEqual(conn._client, client)

0 comments on commit a65f754

Please sign in to comment.