Skip to content

Commit 047d13e

Browse files
committed
Changing BigQuery Connection to only accept client.
1 parent a65f754 commit 047d13e

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

bigquery/google/cloud/bigquery/_http.py

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

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

bigquery/google/cloud/bigquery/client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,14 @@ class Client(ClientWithProject):
7272
``credentials`` for the current object.
7373
"""
7474

75+
SCOPE = ('https://www.googleapis.com/auth/bigquery',
76+
'https://www.googleapis.com/auth/cloud-platform')
77+
"""The scopes required for authenticating as a BigQuery consumer."""
78+
7579
def __init__(self, project=None, credentials=None, http=None):
7680
super(Client, self).__init__(
7781
project=project, credentials=credentials, http=http)
78-
self._connection = Connection(
79-
credentials=self._credentials, http=self._http)
82+
self._connection = Connection(self)
8083

8184
def list_projects(self, max_results=None, page_token=None):
8285
"""List projects for the project associated with this client.

bigquery/unit_tests/test__http.py

Lines changed: 2 additions & 2 deletions
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_no_extra_query_params(self):
30-
conn = self._make_one()
30+
conn = self._make_one(object())
3131
URI = '/'.join([
3232
conn.API_BASE_URL,
3333
'bigquery',
@@ -40,7 +40,7 @@ def test_build_api_url_w_extra_query_params(self):
4040
from six.moves.urllib.parse import parse_qsl
4141
from six.moves.urllib.parse import urlsplit
4242

43-
conn = self._make_one()
43+
conn = self._make_one(object())
4444
uri = conn.build_api_url('/foo', {'bar': 'baz'})
4545
scheme, netloc, path, qs, _ = urlsplit(uri)
4646
self.assertEqual('%s://%s' % (scheme, netloc), conn.API_BASE_URL)

0 commit comments

Comments
 (0)