-
Notifications
You must be signed in to change notification settings - Fork 158
samples: added upload from/download into memory samples #664
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
samples: added upload from/download into memory samples #664
Conversation
Here is the summary of changes. You are about to add 2 region tags.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good besides those few things pointed to.
@@ -0,0 +1,56 @@ | |||
#!/usr/bin/env python | |||
|
|||
# Copyright 2019 Google Inc. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: update to Copyright 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the upload sample, thanks! Whoa I'm not sure if it's Google Inc or Google LLC. Let me check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems the 2021 ones have Google LLC. updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep thanks, i just checked OSPO, and it's Google LLC
|
||
|
||
def download_blob_into_memory(bucket_name, source_blob_name): | ||
"""Downloads a blob from the bucket.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this! Could we update the description to """Downloads a blob into memory.""" and change the parameter name to blob_name
? The word source might be a bit confusing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
storage_upload_from_memory.upload_blob_from_memory( | ||
test_bucket.name, "Hello, is it me you're looking for?", "test_upload_blob" | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could either assert that the blob now exists or assert capsys.readouterr() here just to verify that the print statement successfully ran.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @shaffeeullah for adding the samples🎉 Just a few comments. Also could you help update the samples readme (ref PR), thanks!
No description provided.