是否可以在中使用xgoogifgenerationmatchgoogle.cloud.storagepython客户端?

2024-09-28 03:18:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我在用google.cloud.storagePython库在Google云存储中存储来自myappengine灵活应用程序的文件。我想使用x-goog-if-generation-match头来防止覆盖更新的版本,但是找不到方法将其传递到库。你知道吗

是否可以使用blob生成检查google.cloud.storagePython库?你知道吗


Tags: 文件方法版本应用程序cloudifmatchgoogle
1条回答
网友
1楼 · 发布于 2024-09-28 03:18:35

AFAIK x-goog-if-generation-match头仅在XML API中可用。你知道吗

google.cloud.storage库不允许对请求头进行一般的、直接的访问。在某些情况下,支持访问,但通过专用属性,我发现在^{}中没有与x-goog-if-generation-match等价的属性。你知道吗

不过,我确实看到了检索对象/blob的生成和元生成的方法(但这些方法并不等同于x-goog-if-generation-match):

generation

Retrieve the generation for the object.

See https://cloud.google.com/storage/docs/json_api/v1/objects

Return type: int or NoneType Returns: The generation of the blob or None if the blob’s resource has not been loaded from the server.

以及

metageneration

Retrieve the metageneration for the object.

See https://cloud.google.com/storage/docs/json_api/v1/objects

Return type: int or NoneType Returns: The metageneration of the blob or None if the blob’s resource has not been loaded from the server.

相关问题 更多 >

    热门问题