Bucket information is sometimes unavailable from api instance

未关闭
#266 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
22/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
api, backend

调研方向

The inconsistency sits between b2sdk/bucket.py, where the server response is parsed (around line 970 in the linked v1.9.0 code), and b2sdk/api.py, where a bucket is built from only its id and name when read from the cache (around line 325). Start by reproducing the missing bucketType in as_dict() for a cached bucket. Done means cached and server-fetched buckets report the same fields, or the maintainers pick a design such as caching the full bucket data or fetching on demand. The thread has had no comments in about five years, so confirm the approach with maintainers first.

由索引模型根据 Issue 内容生成。

描述

I have observed application behaviour wherein I'm unable to determine if my bucket is private or not.
If I look at the bucket.as_dict() I can see that "bucketType" as a property is missing.

{'accountId': 'ececece343434', 'bucketId': 'aoeuaoeuaoeu', 'bucketName': 'some-public-bucket', 'bucketInfo': {}, 'corsRules': [], 'lifecycleRules': [], 'revision': None, 'options': set(), 'defaultServerSideEncryption': {'mode': None}, 'isFileLockEnabled': None, 'defaultRetention': {'mode': 'unknown'}}

This is confusing because when retrieving a server response, it looks like this information is checked: https://github.com/Backblaze/b2-sdk-python/blob/v1.9.0/b2sdk/bucket.py#L970

Yet from the cache, it's constructed with solely id and name: https://github.com/Backblaze/b2-sdk-python/blob/v1.9.0/b2sdk/api.py#L325

This leads to an inconsistent experience when interacting with a bucket instance as pulled from the api.

Perhaps the entire bucket dict should be cached? Alternatively that data retrieved on-demand? Not sure.

For now my workaround is to call:
b2_api.session.cache.clear() and retry the call to get_bucket to refresh the data, although I'll have to leave it for some time to see if it fully works.

主要语言
Python
星标
214
派生
68
平均合并
51 分钟
30 天内合并 PR
6

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Backblaze/b2-sdk-python 的其他 Issue

查看 Backblaze/b2-sdk-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。