Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f0adea3

Browse files
committed
Changing speech Connection to only accept client.
1 parent 683ce71 commit f0adea3

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

speech/google/cloud/speech/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ class Client(BaseClient):
5555
variable
5656
"""
5757

58+
SCOPE = ('https://www.googleapis.com/auth/cloud-platform',)
59+
"""The scopes required for authenticating as an API consumer."""
60+
5861
_speech_api = None
5962

6063
def __init__(self, credentials=None, http=None, use_gax=None):
6164
super(Client, self).__init__(credentials=credentials, http=http)
62-
self._connection = Connection(
63-
credentials=self._credentials,
64-
http=self._http,
65-
)
65+
self._connection = Connection(self)
6666

6767
# Save on the actual client class whether we use GAX or not.
6868
if use_gax is None:

speech/google/cloud/speech/connection.py

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

2929
API_URL_TEMPLATE = '{api_base_url}/{api_version}/{path}'
3030
"""A template for the URL of a particular API call."""
31-
32-
SCOPE = ('https://www.googleapis.com/auth/cloud-platform',)
33-
"""The scopes required for authenticating as an API consumer."""

speech/unit_tests/test_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _make_one(self, *args, **kw):
2727
return self._get_target_class()(*args, **kw)
2828

2929
def test_build_api_url(self):
30-
conn = self._make_one()
30+
conn = self._make_one(object())
3131
method = 'speech:syncrecognize'
3232
uri = '/'.join([
3333
conn.API_BASE_URL,

0 commit comments

Comments
 (0)