Content-Length: 323974 | pFad | https://github.com/googleapis/google-cloud-python/commit/725b4f0547c44e27fbb1588c6490c95d94d420de

F1 Changing language Connection to only accept client. · googleapis/google-cloud-python@725b4f0 · GitHub
Skip to content

Commit 725b4f0

Browse files
committed
Changing language Connection to only accept client.
1 parent cb6e0be commit 725b4f0

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

language/google/cloud/language/client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ class Client(client_module.Client):
3737
``credentials`` for the current object.
3838
"""
3939

40+
SCOPE = ('https://www.googleapis.com/auth/cloud-platform',)
41+
"""The scopes required for authenticating as an API consumer."""
42+
4043
def __init__(self, credentials=None, http=None):
4144
super(Client, self).__init__(
4245
credentials=credentials, http=http)
43-
self._connection = Connection(
44-
credentials=self._credentials, http=self._http)
46+
self._connection = Connection(self)
4547

4648
def document_from_text(self, content, **kwargs):
4749
"""Create a plain text document bound to this client.

language/google/cloud/language/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}/documents:{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."""

language/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
uri = '/'.join([
3232
conn.API_BASE_URL,
3333
conn.API_VERSION,

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/googleapis/google-cloud-python/commit/725b4f0547c44e27fbb1588c6490c95d94d420de

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy