-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
After getting a Bucket
instance by calling B2Api.get_bucket_by_id()
, I'm unable to download files with bucket.download_file_by_name()
. A minimal example of the problem:
from b2sdk.v1 import InMemoryAccountInfo, B2Api, DownloadDestLocalFile
app_id = '<app_id>'
app_key = '<app_key>'
bucket_id = '<bucket_id>'
bucket_name = '<bucket_name>'
b2 = B2Api(InMemoryAccountInfo())
b2.authorize_account('production', app_id, app_key)
bucket = b2.get_bucket_by_id(bucket_id)
# bucket = b2.get_bucket_by_name(bucket_name)
dst = DownloadDestLocalFile('local_file_name')
bucket.download_file_by_name('<b2_file_path>', dst)
If the commented line that calls get_bucket_by_name()
is used instead, the snippet works as expected.
Tried both v1.0.2
on PyPI and installing directly from master
(more specifically 1707190).
The problem seems to be that the Bucket
class assumes that its name
attribute is always set in download_file_by_name()
which is not a correct assumption when the bucket is instantiated with B2Api.get_bucket_by_id()
.
Is this a bug or have I missed something in the documentation?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers