Google Apps Meet API Client Library
The `google-apps-meet` library provides a Python client for interacting with the Google Meet API, enabling programmatic creation and management of Meet spaces. It is part of the larger `google-cloud-python` monorepo, currently at version 0.4.0, and receives frequent updates alongside other Google Cloud client libraries.
Common errors
-
ImportError: cannot import name 'SpacesServiceClient' from 'google.apps.meet'
cause Attempting to import the client from an incorrect or non-existent package path.fixThe correct import path for the client is `from google.apps.meet_v2beta import SpacesServiceClient`. -
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials.
cause The client library could not find valid Google Cloud credentials in the environment or could not infer them.fixSet the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to your service account key file path or authenticate using `gcloud auth application-default login`. -
403 Permission denied: The caller does not have permission
cause The authenticated principal (service account or user) lacks the necessary IAM permissions to perform the requested Meet API operation.fixGrant the required roles to your service account or user. For creating spaces, roles like 'Google Meet Admin SDK' or 'Owner' might be needed on the relevant project, or specific delegated permissions.
Warnings
- gotcha Authentication is mandatory for all Google Meet API calls. The client library defaults to using Application Default Credentials (ADC).
- gotcha The primary client for Google Meet is currently `SpacesServiceClient` found under the `v2beta` API version. Other versions or a generic `MeetServiceClient` may not exist or function as expected.
- gotcha When making API calls that require a resource name (e.g., retrieving a specific space), ensure the name is in the correct format (`spaces/SPACE_ID`).
Install
-
pip install google-apps-meet
Imports
- SpacesServiceClient
from google.apps.meet import MeetServiceClient
from google.apps.meet_v2beta import SpacesServiceClient
- Space
from google.apps.meet_v2beta.types import Space
Quickstart
import os
from google.apps.meet_v2beta import SpacesServiceClient
from google.apps.meet_v2beta.types import Space
# --- Authentication Setup ---
# The client library automatically looks for credentials in the following order:
# 1. The GOOGLE_APPLICATION_CREDENTIALS environment variable.
# 2. Credentials from `gcloud auth application-default login`.
# 3. Credentials from the Google Cloud SDK (e.g., from `gcloud auth login`).
# For local development, set GOOGLE_APPLICATION_CREDENTIALS or use `gcloud auth application-default login`.
# Example: export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/keyfile.json"
# Initialize the client
client = SpacesServiceClient()
# Create a new Google Meet space
# An empty Space object is often sufficient for creation, letting the API fill in defaults.
# For advanced configuration, populate the Space object with a SpaceConfig.
new_space = Space()
try:
created_space = client.create_space(space=new_space)
print(f"Successfully created Meet Space.")
print(f"Space Name: {created_space.name}")
print(f"Meeting URI: {created_space.meeting_uri}")
except Exception as e:
print(f"An error occurred: {e}")
if "credentials" in str(e) or "Permission denied" in str(e):
print("Hint: Check your authentication setup and IAM permissions (e.g., 'Google Meet Admin SDK' role).")