Skip to content

Instantly share code, notes, and snippets.

@vperezb
Last active February 27, 2019 11:41
Show Gist options
  • Save vperezb/d33acb0aa7f4de5cb2b6109580e91e0c to your computer and use it in GitHub Desktop.
Save vperezb/d33acb0aa7f4de5cb2b6109580e91e0c to your computer and use it in GitHub Desktop.
def get_service(secrets_path, service_scope, service_build, service_version):
credentials = ServiceAccountCredentials.from_json_keyfile_name(
secrets_path,
scopes= service_scope
)
service = build(
service_build,
service_version,
http=credentials.authorize(Http()),
cache_discovery=False
)
return service
# https://developers.google.com/identity/protocols/googlescopes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment