pythongoogle-cloud-platformgoogle-compute-enginegoogle-client

How do I batch a request to Compute Engine using the Python Google Cloud Client Libraries?


In the older Google API Client Libraries, you could batch a request to label many instances at once, using googleapiclient, discovery.build("compute", "v1").new_batch_http_request(...)

With the new, recommended Cloud Client Libraries, you can set labels on one instance with setLabels, but I don't see a way to batch these requests.

The documentation mentions the batching of requests, but only with a direct HTTPS call, and I would rather use a Python library. This documentation does refer to a Python library, but only the older Google API Client Libraries.

I don't mind using the older Google API Client libraries, but, though they are officially supported, they have had, since 2016 at least, severe bugs causing invocation failure. (This is in their SSL implementation, see 1, 2 and more). This makes them impossible to use.


Solution

  • It is simply not possible to batch requests with the "Cloud Client Libraries".