The `google-cloud-quotas` library is the official Python client for the Google Cloud Quotas API. It allows developers to programmatically list and manage service quotas for their Google Cloud projects. As part of the larger `google-cloud-python` monorepo, it receives updates as new API features are released, typically aligning with the Google Cloud release cycle.
pip install google-cloud-quotasVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `QuotasClient` and list the quotas for a specified Google Cloud project and location. It assumes default authentication is set up (e.g., `GOOGLE_APPLICATION_CREDENTIALS` or `gcloud auth application-default login`). Remember to replace 'your-project-id' or set the `GOOGLE_CLOUD_PROJECT` environment variable.
Upgrade your Python environment to 3.9+ using tools like `pyenv` or `conda`.
Ensure `GOOGLE_APPLICATION_CREDENTIALS` environment variable points to a valid service account key file, or run `gcloud auth application-default login` to set up user credentials. The service account/user must have the necessary IAM roles (e.g., `Service Usage Viewer`).
Construct the `parent` string carefully, for example: `f"projects/{project_id}/locations/global"` or `f"projects/{project_id}/locations/us-central1"`.Grant the service account or user making the API call the `roles/serviceusage.serviceUsageViewer` role or a custom role with `serviceusage.quotas.get` permission on the target project.