Skip to content

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

Merged
merged 7 commits into from
Dec 10, 2021
Merged

samples: added upload from/download into memory samples #664

merged 7 commits into from
Dec 10, 2021

Conversation

shaffeeullah
Copy link
Contributor

No description provided.

@shaffeeullah shaffeeullah requested review from a team as code owners December 10, 2021 20:45
@shaffeeullah shaffeeullah requested a review from engelke December 10, 2021 20:45
@snippet-bot
Copy link

snippet-bot bot commented Dec 10, 2021

Here is the summary of changes.

You are about to add 2 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added api: storage Issues related to the googleapis/python-storage API. samples Issues that are directly related to samples. labels Dec 10, 2021
@shaffeeullah shaffeeullah requested a review from cojenco December 10, 2021 20:45
Copy link
Contributor

@unforced unforced left a 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.
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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."""
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@shaffeeullah shaffeeullah requested a review from cojenco December 10, 2021 21:38
storage_upload_from_memory.upload_blob_from_memory(
test_bucket.name, "Hello, is it me you're looking for?", "test_upload_blob"
)

Copy link
Contributor

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.

Copy link
Contributor

@cojenco cojenco left a 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!

@shaffeeullah shaffeeullah requested a review from cojenco December 10, 2021 22:04
@shaffeeullah shaffeeullah merged commit b841482 into googleapis:main Dec 10, 2021
@shaffeeullah shaffeeullah deleted the uploaddownloadfrommemory branch December 10, 2021 22:36
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 googleapis/python-storage API. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants