Skip to content

Commit

Permalink
Changing BigQuery 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 a65f754 commit 047d13e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 0 additions & 4 deletions bigquery/google/cloud/bigquery/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,3 @@ class Connection(_http.JSONConnection):

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

SCOPE = ('https://www.googleapis.com/auth/bigquery',
'https://www.googleapis.com/auth/cloud-platform')
"""The scopes required for authenticating as a BigQuery consumer."""
7 changes: 5 additions & 2 deletions bigquery/google/cloud/bigquery/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ class Client(ClientWithProject):
``credentials`` for the current object.
"""

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

def __init__(self, project=None, credentials=None, http=None):
super(Client, self).__init__(
project=project, credentials=credentials, http=http)
self._connection = Connection(
credentials=self._credentials, http=self._http)
self._connection = Connection(self)

def list_projects(self, max_results=None, page_token=None):
"""List projects for the project associated with this client.
Expand Down
4 changes: 2 additions & 2 deletions bigquery/unit_tests/test__http.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _make_one(self, *args, **kw):
return self._get_target_class()(*args, **kw)

def test_build_api_url_no_extra_query_params(self):
conn = self._make_one()
conn = self._make_one(object())
URI = '/'.join([
conn.API_BASE_URL,
'bigquery',
Expand All @@ -40,7 +40,7 @@ def test_build_api_url_w_extra_query_params(self):
from six.moves.urllib.parse import parse_qsl
from six.moves.urllib.parse import urlsplit

conn = self._make_one()
conn = self._make_one(object())
uri = conn.build_api_url('/foo', {'bar': 'baz'})
scheme, netloc, path, qs, _ = urlsplit(uri)
self.assertEqual('%s://%s' % (scheme, netloc), conn.API_BASE_URL)
Expand Down

0 comments on commit 047d13e

Please sign in to comment.