我试图在谷歌桶上设置CORS配置。我指的是https://cloud.google.com/storage/docs/xml-api/put-bucket-cors。有人能帮我如何在python中使用这个请求吗?
发布于 2017-04-10 19:15:35
您可能希望使用JSON,并使用谷歌云存储库。桶的文档是这里。
我还没试过,但有点像:
from google.cloud import storage bucket = storage.Client().get_bucket('bucket-id-here') bucket.cors = [{ origin: ['*', ...], method: ['GET', ...], responseHeader: ['some-resp-header', ...], maxAgeSeconds: 86400, # one day }] bucket.patch() # Send the update
https://stackoverflow.com/questions/43331017
相似问题