BigQuery is a REST API, the errors it uses follow standard HTTP error conventions.

In python, an HttpError has a resp.status field that returns the HTTP status code. As you show above, 409 is 'conflict', 404 is 'not found'.

For example:

from googleapiclient.errors import HttpError
try:
   ...
except HttpError as err:
  # If the error is a rate limit or connection error,
  # wait and try again.
  if err.resp.status in [403, 500, 503]:
    time.sleep(5)
  else: raise

The response is also a json object, an even better way is to parse the json and read the error reason field:

if err.resp.get('content-type', '').startswith('application/json'):
    reason = json.loads(err.content).get('error').get('errors')[0].get('reason')

This can be: notFound, duplicate, accessDenied, invalidQuery, backendError, resourcesExceeded, invalid, quotaExceeded, rateLimitExceeded, timeout, etc.

Answer from Jordan Tigani on Stack Overflow
๐ŸŒ
Google
docs.cloud.google.com โ€บ ai and ml โ€บ vertex ai โ€บ generative ai on vertex ai โ€บ generate virtual try-on images
Generate Virtual Try-On Images | Generative AI on Vertex AI | Google Cloud Documentation
Enable the API ยท Set up authentication for your environment. Select the tab for how you plan to use the samples on this page: To use the Python samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
๐ŸŒ
Google
docs.cloud.google.com โ€บ ai and ml โ€บ vertex ai โ€บ generative ai on vertex ai โ€บ virtual try-on api
Virtual Try-On API | Generative AI on Vertex AI | Google Cloud Documentation
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method POST ` -Headers $headers ` -ContentType: "application/json; charset=utf-8" ` -InFile request.json ` -Uri "https://REGION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/publishers/google/models/virtual-try-on-preview-08-04:predict" | Select-Object -Expand Content The request returns image objects.
๐ŸŒ
Google
developers.google.com โ€บ google workspace โ€บ google docs โ€บ python quickstart
Python quickstart | Google Docs | Google for Developers
If you're signed in to multiple accounts, select one account to use for authorization. Click Accept. Your Python application runs and calls the Google Docs API. Authorization information is stored in the file system, so the next time you run the sample code, you aren't prompted for authorization. Try the Google Workspace APIs in the APIs explorer
๐ŸŒ
GitHub
github.com โ€บ googleapis โ€บ google-api-python-client
GitHub - googleapis/google-api-python-client: ๐Ÿ The official Python client library for Google's discovery based APIs.
The 2.0 release of google-api-python-client includes a substantial reliability improvement, compared with 1.x, as discovery documents are now cached in the library rather than fetched dynamically. It is highly recommended to upgrade from v1.x to v2.x. Only python 3.7 and newer is supported.
Starred by 8.6K users
Forked by 2.5K users
Languages ย  Python 94.1% | Shell 5.7% | Makefile 0.2%
๐ŸŒ
CodeRivers
coderivers.org โ€บ blog โ€บ google-api-python
Mastering Google API with Python: A Comprehensive Guide - CodeRivers
April 22, 2025 - Google API requests can sometimes fail due to various reasons such as network issues, authentication problems, or rate limits. Always use try - except blocks to handle errors gracefully.
๐ŸŒ
GitHub
googleapis.github.io โ€บ google-api-python-client โ€บ docs โ€บ start.html
Getting Started | google-api-python-client
You can see the list of all API versions on the Supported APIs page. When build() is called, a service object will attempt to be constructed with methods specific to the given API. httplib2, the underlying transport library, makes all connections persistent by default. Use the service object with a context manager or call close to avoid leaving sockets open. from googleapiclient.discovery import build service = build('drive', 'v3') # ...
๐ŸŒ
Google
developers.google.com โ€บ google workspace โ€บ google drive โ€บ python quickstart
Python quickstart | Google Drive | Google for Developers
If you're signed in to multiple accounts, select one account to use for authorization. Click Accept. Your Python application runs and calls the Google Drive API. Authorization information is stored in the file system, so the next time you run the sample code, you aren't prompted for authorization. Try the Google Workspace APIs in the APIs explorer
Find elsewhere
๐ŸŒ
Martin Heinz
martinheinz.dev โ€บ blog โ€บ 84
Getting Started with Google APIs in Python | Martin Heinz | Personal Website & Blog
November 1, 2022 - We need 2 of them, one for authentication and one for the actual Google APIs: pip install google-auth-oauthlib pip install google-api-python-client ยท Now we're ready to start writing some Python code. First thing we need to do is authenticate and get user consent: from pathlib import Path ...
๐ŸŒ
Google
developers.google.com โ€บ google workspace โ€บ gmail โ€บ python quickstart
Python quickstart | Gmail | Google for Developers
If you're signed in to multiple accounts, select one account to use for authorization. Click Accept. Your Python application runs and calls the Gmail API. Authorization information is stored in the file system, so the next time you run the sample code, you aren't prompted for authorization. Try the ...
๐ŸŒ
Google
developers.google.com โ€บ google ads api โ€บ try out the rest interface
Try out the REST interface | Google Ads API | Google for Developers
button which you can use to send a single request to the Google Ads API to verify its behavior. To use it, you need your developer token and the customer ID for the account you want to issue the request against.
๐ŸŒ
Google AI
ai.google.dev โ€บ gemini api โ€บ gemini api quickstart
Gemini API quickstart | Google AI for Developers
... This quickstart shows you how ... have one, you can get it for free in Google AI Studio. Using Python 3.9+, install the google-genai package ......
๐ŸŒ
Google
developers.google.com โ€บ people api โ€บ python quickstart
Python quickstart | People API | Google for Developers
If you're signed in to multiple accounts, select one account to use for authorization. Click Accept. Your Python application runs and calls the People API. Authorization information is stored in the file system, so the next time you run the sample code, you aren't prompted for authorization. Try ...
๐ŸŒ
GitHub
github.com โ€บ oyeolamilekan โ€บ gemini-ai-tryon
GitHub - oyeolamilekan/gemini-ai-tryon: An AI-powered virtual try-on app built with Next.js and Google Gemini. Upload your photo and a clothing item to see how it looks!
โœจ AI-Powered Try-On: Uses the Google Gemini API (specifically a flash experimental model) to generate the virtual try-on image.
Starred by 49 users
Forked by 20 users
Languages ย  TypeScript 96.6% | CSS 1.7% | JavaScript 1.7%
๐ŸŒ
Google
developers.google.com โ€บ google workspace โ€บ google sheets โ€บ python quickstart
Python quickstart | Google Sheets | Google for Developers
If you're signed in to multiple accounts, select one account to use for authorization. Click Accept. Your Python application runs and calls the Google Sheets API. Authorization information is stored in the file system, so the next time you run the sample code, you aren't prompted for authorization. Try the Google Workspace APIs in the APIs explorer
๐ŸŒ
Google
developers.google.com โ€บ apis-explorer
Google APIs Explorer | Google for Developers
On the right, enter the details of your request in the panel labeled "Try this method." Or, click Full screen fullscreen for more options. Click Execute to send your request to the API and see the API's response.
๐ŸŒ
Google Cloud
console.cloud.google.com โ€บ vertex-ai โ€บ publishers โ€บ google โ€บ model-garden โ€บ virtual-try-on-preview-08-04
Virtual Try-On preview - Vertex AI
Google Cloud Console has failed to load JavaScript sources from www.gstatic.com. Possible reasons are:www.gstatic.com or its IP addresses are blocked by your network administratorGoogle has temporarily blocked your account or network due to excessive automated requestsPlease contact your network ...
๐ŸŒ
Towards Data Science
towardsdatascience.com โ€บ home โ€บ latest โ€บ getting started with google apis in python
Getting Started with Google APIs in Python | Towards Data Science
March 5, 2025 - In this article I tried to capture most of the usual workflows and concepts โ€“ such batch processing, pagination, search or authentication โ€“ that you might encounter when working with Google APIs. Itโ€™s however not an exhaustive guide to everything that can be done with them, so be sure to check out other resources, such as Python API client samples or Google Workspace samples and snippets.