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

[storage] feat: add post policy sample #3231

Merged
merged 6 commits into from
Apr 3, 2020
Merged

[storage] feat: add post policy sample #3231

merged 6 commits into from
Apr 3, 2020

Conversation

frankyn
Copy link
Member

@frankyn frankyn commented Mar 31, 2020

@frankyn frankyn added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Mar 31, 2020
@frankyn frankyn requested a review from jkwlui March 31, 2020 01:48
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 31, 2020
@frankyn frankyn removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Apr 3, 2020
@frankyn frankyn marked this pull request as ready for review April 3, 2020 07:23
@frankyn frankyn requested review from crwilcox and a team as code owners April 3, 2020 07:23

def generate_signed_post_policy_v4(bucket_name, blob_name):
"""Generates a v4 POST Policy and prints an HTML form."""
# bucket_name = 'your-bucket-name'
Copy link
Contributor

Choose a reason for hiding this comment

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

We do this in other samples also, but it seems odd to me that these aren't just documents in the docstring of the method. For instance https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/storage/cloud-client/storage_create_bucket.py#L25

Copy link
Member Author

Choose a reason for hiding this comment

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

It's the way we've done it for a while now but open to changing it. IIUC it's part of sample expectations for Python and was approved.

form = header.format(policy["url"])

# Include all fields returned in the HTML form as they're required
for index, (key, value) in enumerate(policy["fields"].items()):
Copy link
Collaborator

Choose a reason for hiding this comment

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

for key, value in policy["fields"].items():

Copy link
Collaborator

@jkwlui jkwlui left a comment

Choose a reason for hiding this comment

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

one nit, LGTM

@frankyn frankyn added the automerge Merge the pull request once unit tests and other checks pass. label Apr 3, 2020
@frankyn frankyn merged commit ba4d402 into master Apr 3, 2020
@frankyn frankyn deleted the post-policy-sample branch April 3, 2020 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge the pull request once unit tests and other checks pass. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants