-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Downloads and uploads requires listBuckets permission #497
Comments
You can use a key restricted to a bucket - in this case |
Thanks for the reply. But it's still unclear when (and how) that cache gets updated with the bucket id and bucket name. Following the tutorial (with real keys of course):
The last line fails with an Thanks again |
Seems the source of your problem to be in: b2-sdk-python/b2sdk/_internal/session.py Lines 74 to 79 in aaf8569
I have to look more into this behavior, as my first instinct would be to change it, but we have a strong non-breaking changes policy. In short, if AccountInfo is manually passed, then cache object is not automagically created for API and it is to expected to be passed in, explicitly, as you did with AccountInfo, i.e. from b2sdk.v2 import B2Api, InMemoryAccountInfo, InMemoryCache
info = InMemoryAccountInfo()
b2_api = B2Api(
info,
cache=InMemoryCache() # Without this line Bucket-specific Key with only readFiles capability won't work
) |
Thank you very much @ppolewicz , your solution does seem to work and I understand what's going on. |
To avoid breaking changes, the change was made to yet not stable from b2sdk.v2 import B2Api, InMemoryAccountInfo, AuthInfoCache
info = InMemoryAccountInfo()
b2_api = B2Api(
info,
cache=AuthInfoCache(info)
) where as in |
Hi,
I just started testing the b2sdk and realised that downloads and uploads (other than download_file_by_id) require the listBuckets permission. This is because get_bucket_by_name (or get_bucket_by_id) must be called to create a bucket object, and this request makes a list_buckets request.
Is there a way around the list_buckets request, because this seems like an unnecessary extra permission to download and upload files?
Thanks
The text was updated successfully, but these errors were encountered: