Skip to content

Commit

Permalink
Added scopes as arg to service builder
Browse files Browse the repository at this point in the history
  • Loading branch information
elibixby committed May 22, 2015
1 parent 87631e0 commit 8d7a1ca
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions discoverydoccaching/discovery_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@

RESOURCE_PATH = '..' # look for discovery docs in the parent folder
MAX_AGE = 86400 # update discovery docs older than a day
BIGQUERY_SCOPES = ['https://www.googleapis.com/auth/bigquery']


def build_and_update(api, version):
def build_and_update(api, version, scopes=None):
from oauth2client.client import GoogleCredentials
from googleapiclient.discovery import build_from_document

Expand All @@ -42,8 +40,8 @@ def build_and_update(api, version):
_update_discovery_doc(api, version, path)

credentials = GoogleCredentials.get_application_default()
if credentials.create_scoped_required():
credentials = credentials.create_scoped(BIGQUERY_SCOPES)
if not scopes is None and credentials.create_scoped_required():

This comment has been minimized.

Copy link
@theacodes

theacodes May 22, 2015

Contributor

nit: scopes is not None. Yoda would be proud, though.

credentials = credentials.create_scoped(scopes)
with open(path, 'r') as discovery_doc:
return build_from_document(discovery_doc.read(),
http=httplib2.Http(),
Expand Down

0 comments on commit 8d7a1ca

Please sign in to comment.