{"id":397,"library":"google-api-python-client","title":"Google API Client Library for Python","description":"A Python client library for Google's discovery-based APIs, currently at version 2.193.0, with weekly releases. Note: This library is in maintenance mode; for new development, consider using Cloud Client Libraries for Python.","status":"maintenance","version":"2.193.0","language":"python","source_language":"en","source_url":"https://github.com/googleapis/google-api-python-client/","tags":["Google API","Python","Client Library","Maintenance Mode"],"install":[{"cmd":"pip install google-api-python-client","lang":"bash","label":"Install google-api-python-client"}],"dependencies":[{"reason":"HTTP client for Python, required for making API requests.","package":"httplib2"},{"reason":"Library for parsing and expanding URI templates, used in API requests.","package":"uritemplate"}],"imports":[{"note":"Ensure correct import path to access the 'build' function for creating service objects.","symbol":"build","correct":"from googleapiclient.discovery import build"}],"quickstart":{"code":"import os\nfrom googleapiclient.discovery import build\n\n# Set up the API client\nservice = build('drive', 'v3', developerKey=os.environ.get('API_KEY'))\n\n# Call the API\nresults = service.files().list(pageSize=10, fields='files(id, name)').execute()\nitems = results.get('files', [])\n\nif not items:\n    print('No files found.')\nelse:\n    print('Files:')\n    for item in items:\n        print(f'{item['name']} ({item['id']})')","lang":"python","description":"Quickstart example to list files from Google Drive using the API client."},"warnings":[{"fix":"Use Cloud Client Libraries for Python for new development.","message":"The google-api-python-client library is in maintenance mode and will not add new features. For new development, consider using Cloud Client Libraries for Python.","severity":"deprecated","affected_versions":"all"},{"fix":"Use 'from googleapiclient.discovery import build' for correct import.","message":"Ensure that the 'build' function is imported from 'googleapiclient.discovery' to avoid ImportError.","severity":"gotcha","affected_versions":"all"},{"fix":"Use different quote types for the f-string and its contents (e.g., f\"Your item is {item['name']}\" or f'{item[\"name\"]}') or escape the inner quotes (e.g., f'{item[\\'name\\']})'.","message":"F-strings containing nested quotes (e.g., for dictionary keys) must use different quote types for the f-string delimiter and the inner quotes to avoid a SyntaxError.","severity":"gotcha","affected_versions":"python:3.6+"},{"fix":"Ensure Application Default Credentials are set up in your environment by following the instructions at https://cloud.google.com/docs/authentication/external/set-up-adc. This often involves setting the GOOGLE_APPLICATION_CREDENTIALS environment variable or authenticating with `gcloud auth application-default login`.","message":"Encountered DefaultCredentialsError when accessing Google APIs. This typically means that Application Default Credentials (ADC) are not configured. The application failed to find credentials.","severity":"breaking","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-12T13:31:14.469Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Ensure the `google-api-python-client` package is installed: `pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib`","cause":"The `googleapiclient` library or its dependencies are not installed, or the Python environment where the code is run does not have access to the installed packages.","error":"ModuleNotFoundError: No module named 'googleapiclient'"},{"fix":"Go to the Google Cloud Console (console.cloud.google.com), navigate to 'APIs & Services' -> 'Library', search for the API you need (e.g., 'Gmail API', 'Google Sheets API'), and click 'Enable'. Verify that you are using the correct project ID in your code and in the console.","cause":"The specific Google API you are trying to access has not been enabled for your Google Cloud Project, or there is a mismatch in the project ID being used.","error":"HttpError 403 when requesting ... returned \"API has not been used in project ... before or it is disabled.\""},{"fix":"The user needs to re-authorize your application. Delete any stored `token.json` or `.pickle` files, which will force a new authorization flow to obtain a fresh refresh token. Ensure your application's OAuth consent screen is configured for production if applicable, as testing applications have limited refresh token lifetimes.","cause":"The OAuth 2.0 refresh token used to obtain new access tokens has expired or been revoked. This can happen if the user explicitly revoked access, the token exceeded its lifetime (e.g., for testing apps), or the user changed their password.","error":"google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked.', ...)"},{"fix":"Check the quotas for the relevant API in the Google Cloud Console under 'APIs & Services' -> 'Quotas'. You may need to request a quota increase if your usage demands it, or implement exponential backoff and retry logic in your application to handle temporary rate limits gracefully.","cause":"Your Google Cloud Project or user account has exceeded the allowed API request limits (quotas) for the specific Google API being called.","error":"HttpError 403 ... Quota exceeded for quota metric 'Requests' ..."}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.82,"mem_mb":16.4,"disk_size":"141.5M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.6,"mem_mb":16.4,"disk_size":"142M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.51,"mem_mb":18,"disk_size":"145.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.97,"mem_mb":18,"disk_size":"146M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.3,"mem_mb":17.9,"disk_size":"137.1M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.31,"mem_mb":17.9,"disk_size":"138M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.32,"mem_mb":18.9,"disk_size":"136.7M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":1.33,"mem_mb":18.9,"disk_size":"137M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.71,"mem_mb":16.1,"disk_size":"141.5M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.66,"mem_mb":16.1,"disk_size":"142M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}}