Skip to content

Add keyword arguments to google.cloud.storage.Bucket.get_blob. - #3613

Merged
tseaver merged 5 commits into
googleapis:masterfrom
tillahoffmann:get_blob-kwargs
Jul 19, 2017
Merged

Add keyword arguments to google.cloud.storage.Bucket.get_blob.#3613
tseaver merged 5 commits into
googleapis:masterfrom
tillahoffmann:get_blob-kwargs

Conversation

@tillahoffmann

Copy link
Copy Markdown
Contributor

This PR adds kwargs to the get_blob method of google.cloud.storage.Bucket to support passing chunk_size, encryption_key and any future parameters the Blob constructor may have.

@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 17, 2017
@tseavertseaver added api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jul 17, 2017
@tseaver

Copy link
Copy Markdown
Contributor

@tillahoffmann Thanks for the patch! Could you please add a unit test which exercises the **kwargs feature for get_blob?

@tillahoffmann

Copy link
Copy Markdown
ContributorAuthor

@tseaver, added a test and also the encryption headers such that the get_blobs retrieves information such as hashes with the correct encryption key.

from google.cloud.storage.acl import BucketACL
from google.cloud.storage.acl import DefaultObjectACL
from google.cloud.storage.blob import Blob
from google.cloud.storage.blob import Blob, _get_encryption_headers

This comment was marked as spam.

method='GET', path=blob.path, _target_object=blob)
method='GET', path=blob.path, _target_object=blob,
headers=headers
)

This comment was marked as spam.

self.assertEqual(blob.name, BLOB_NAME)
kw, = connection._requested
self.assertEqual(kw['method'], 'GET')
self.assertEqual(kw['path'], '/b/%s/o/%s' % (NAME, BLOB_NAME))

This comment was marked as spam.

@tseaver

Copy link
Copy Markdown
Contributor

Looks like #3627 fixes the master branch for those test errors.

@tseaver
tseaver merged commit ffd7cca into googleapis:masterJul 19, 2017
@tillahoffmann
tillahoffmann deleted the get_blob-kwargs branch July 20, 2017 01:38
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 21, 2017
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
landrito pushed a commit to landrito/google-cloud-python that referenced this pull request Aug 22, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storageIssues related to the Cloud Storage API.cla: yesThis human has signed the Contributor License Agreement.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@tillahoffmann@tseaver@googlebot