File tree 1 file changed +3
-5
lines changed
1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change 26
26
27
27
RESOURCE_PATH = '..' # look for discovery docs in the parent folder
28
28
MAX_AGE = 86400 # update discovery docs older than a day
29
- BIGQUERY_SCOPES = ['https://www.googleapis.com/auth/bigquery' ]
30
29
31
-
32
- def build_and_update (api , version ):
30
+ def build_and_update (api , version , scopes = None ):
33
31
from oauth2client .client import GoogleCredentials
34
32
from googleapiclient .discovery import build_from_document
35
33
@@ -42,8 +40,8 @@ def build_and_update(api, version):
42
40
_update_discovery_doc (api , version , path )
43
41
44
42
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 )
47
45
with open (path , 'r' ) as discovery_doc :
48
46
return build_from_document (discovery_doc .read (),
49
47
http = httplib2 .Http (),
You can’t perform that action at this time.
0 commit comments