google/google-api-python-client — pull request #4 by orestica (2014-05-09 05:18:33+00:00)
Title: Add support for default credentials.

This pull request goes hand in hand with the following pull request: https://github.com/google/oauth2client/pull/6

Once these two pull requests are accepted and integrated into their respective repositories, a Google API call will be authenticated as simple as building the service like this:

service = build("compute", "v1", credential=GoogleCredential.get_default_credential())

This will work when the code is being run on a VM inside Google Compute Engine, a Google App Engine application or on any other off-fabric platform (in this last case, a credentials file needs to be put together containing either user or service account credentials and an environment variable pointed to it OR a 'gcloud auth login' command needs to be run before using the default credentials).