Skip to content

Commit

Permalink
Make authn sample more uniform with the java one.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerjou Cheng committed Aug 13, 2015
1 parent b453dc5 commit 67590f6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bigquery/samples/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ def get_service():
from oauth2client.client import GoogleCredentials

credentials = GoogleCredentials.get_application_default()

# Some credential types require you to specify scopes, and service entry
# points may not inject them. Check for this case, and inject the scopes
# explicitly if required.
if credentials.create_scoped_required():
credentials = credentials.create_scoped(
'https://www.googleapis.com/auth/bigquery')

# Otherwise, the build() method takes care of injecting the proper scopes
# for the given service.
return build('bigquery', 'v2', credentials=credentials)
# [END get_service]

Expand Down

0 comments on commit 67590f6

Please sign in to comment.