Skip to main content

obtain Google GCloud configuration credentials

Project description

gcloud config helper

This library allows you to use the current gcloud configuration credentials to authenticate with against the google APIs.

The library provides the class GCloudCredentials which wraps the gcloud config config-helper command.

To use:

import gcloud_config_helper
credentials, project = gcloud_config_helper.default()

Next you can pass these credentials in when constructing an API client:

from import compute_v1
c = compute_v1.InstancesClient(credentials=credentials)
for zone, instances in c.aggregated_list(request={"project": project}):
    for instance in instances.instances:
        print(f'found {} in zone {zone}')

Note that Google documentation states that gcloud config config-helper should be regarded as an unstable interface.

if you want, you can use the gcloud_config_helper.on_path() to determine to use gcloud or the default credentials:

if google_config_helper.on_path():
   credentials, project = gcloud_config_helper.default()
else:"using application default credentials")
   credentials, project = google.auth.default() Documentation Status

obtain Google gcloud configuration credentials

  • Free software: Apache Software License 2.0


0.1.0 (2021-04-24)

  • First release on PyPI.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcloud_config_helper-0.3.1.tar.gz (11.2 kB view hashes)

Uploaded Source

Built Distribution

gcloud_config_helper-0.3.1-py2.py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page