Skip to content

Commit 8d7a1ca

Browse files
committed
Added scopes as arg to service builder
1 parent 87631e0 commit 8d7a1ca

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

discoverydoccaching/discovery_doc.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@
2626

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

31-
32-
def build_and_update(api, version):
30+
def build_and_update(api, version, scopes=None):
3331
from oauth2client.client import GoogleCredentials
3432
from googleapiclient.discovery import build_from_document
3533

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

4442
credentials = GoogleCredentials.get_application_default()
45-
if credentials.create_scoped_required():
46-
credentials = credentials.create_scoped(BIGQUERY_SCOPES)
43+
if not scopes is None and credentials.create_scoped_required():
44+
credentials = credentials.create_scoped(scopes)
4745
with open(path, 'r') as discovery_doc:
4846
return build_from_document(discovery_doc.read(),
4947
http=httplib2.Http(),

0 commit comments

Comments
 (0)