Skip to content

Should Blob and Bucket constructors fall back to _implicit_environ defaults? #621

@tseaver

Description

@tseaver

Bucket.__init__() currently has connection=None as a defaulted argument, and does nothing to "normalize" that value (i.e., by using the one set in _implicit_environ. ISTM that it would be useful to have the following work, assuming the envvars are set:

from gcloud.storage import set_defaults
from gcloud.storage.bucket import Bucket

set_defaults()

bucket = Bucket()

for blob in bucket:
    blob.download_to_filename(os.path.join(tmpdir, blob.name))

Likewise, Blob.__init__() could use the default bucket:

from gcloud.storage import set_defaults
from gcloud.storage.bucket import Blob

set_defaults()

blob = Blob('foobar.pdf')
blob.download_to_filename(os.path.join(tmpdir, blob.name))

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions