Bucket.download_file_by_name fails when getting bucket with B2Api.get_bucket_by_id
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- Une demi-journée
- Accessibilité débutants
- 42/100
Piste de recherche
Start with download_file_by_name() in b2sdk/bucket.py, which assumes self.name is set, and compare it with get_bucket_by_name() to see how a Bucket built by B2Api.get_bucket_by_id() gets its name. Reproduce with the snippet in the issue, then check that a download by name works after fetching the bucket by id. The work is probably already superseded in the current release, so confirm against the latest code before starting.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
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 1707190972a5d6807c7d928dd5d295dce6920915).
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?
- Langage dominant
- Python
- Étoiles
- 214
- Forks
- 68
- Merge moyen
- 51 min
- PR mergées (30 j)
- 6
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de Backblaze/b2-sdk-python
-
Download and copy sync actions print remote file names without escape_control_charsPeut-être pris @dreyfus92 l’a pris il y a 15 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Backblaze/b2-sdk-python#631 ·
Les mainteneurs répondent en général sous 1 jour
-
SqliteAccountInfo profile name validation uses "re.match", so only the first character is checkedPeut-être pris @nazarli-shabnam l’a pris il y a 9 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Backblaze/b2-sdk-python#629 ·
Les mainteneurs répondent en général sous 1 jour
-
Adopt the AI-native SDLC and repository policiesPeut-être pris @goanpeca l’a pris il y a 18 jours. Ouverteenhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 20/100
Backblaze/b2-sdk-python#634 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 50/100
Backblaze/b2-sdk-python#630 ·
Les mainteneurs répondent en général sous 1 jour
-
ci: cli-compat fails — 4 sse/sync integration tests broken in B2_Command_Line_Tool (all environments)Peut-être à nouveau libre @ffumero2003 l’a pris il y a 37 jours, et aucune pull request n’est ouverte. Ouvertebug testing
Backblaze/b2-sdk-python#627 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de Backblaze/b2-sdk-python
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
btclib-org/btclib-node#2505 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
open-webui/open-webui#34462 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
gorakhargosh/watchdog#1462 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
openwisp/openwisp-monitoring#889 ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
IETF-Hackathon/pqc-certificates#351 ·
Les mainteneurs répondent en général sous 2 jours