How to install CacheControl in new Cloud Storage Api (Python)?

I follow the recommendations and update my code to use the new cloud storage API in GAE, I need to set cachecontrol headers, before it was easy:

files.gs.create(filename, mime_type='image/png', acl='public-read', cache_control='public, max-age=100000, must-revalidate' ) 

BUT, with the new API, the manuals say that "cache_control" is not available ... I get this error when trying to set cache control inside the parameters:

 ValueError: option cache_control is not supported. 

Tried using Cache-Control the same error ...

As usual, the documentation for the new API is not suitable.

Can someone help me customize cache headers in the new Cloud Storage API using PYTHON. In case this is not possible, can I use the old api for my project?

Thanks.

+4
source share
1 answer

You're right. As described here , the open function only supports x-goog-acl and x-goog-meta headers.

In the near future, cache management may be added to facilitate migration. Note that the main value of the GCS client library is buffered read, resumable write buffering, and automatic retry of attempts to overcome temporary errors. Many other simple REST operations in GCS (e.g. cache, file copying, bucket creation ...) can already be performed by the Google API Client . The "drawback" of the Google API client is that since it does not come directly from / for the App Engine, it does not have application developer support.

+2
source

Source: https://habr.com/ru/post/1486637/


All Articles