Skip to content
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

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

Merged
merged 5 commits into from
Jul 19, 2017
Merged

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

merged 5 commits into from
Jul 19, 2017

Conversation

tillahoffmann
Copy link
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.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 17, 2017
@tseaver tseaver 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
Contributor

tseaver commented Jul 17, 2017

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

@tillahoffmann
Copy link
Contributor Author

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

@@ -33,7 +33,7 @@
from google.cloud.storage._helpers import _validate_name
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
Contributor

tseaver commented Jul 19, 2017

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

@tseaver tseaver merged commit ffd7cca into googleapis:master Jul 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. cla: yes This 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