Skip to content

Bucket information is sometimes unavailable from api instance #266

Description

@ehossack

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions