-
Notifications
You must be signed in to change notification settings - Fork 6.6k
feat(storage): Add snippets for v4 signed URLs #2142
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
Conversation
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 @jkwlui, I never clicked "submit review", apologies for the delay.
storage/cloud-client/snippets.py
Outdated
print("curl -X PUT -H 'Content-Type: application/octet-stream' " | ||
"--upload-file my-file \'{}\''.format(url)") | ||
return url | ||
# [END storage_generate_signed_url_v4] |
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: storage_generate_upload_signed_url_v4
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.
good catch! thanks!
@@ -350,6 +406,14 @@ def copy_blob(bucket_name, blob_name, new_bucket_name, new_blob_name): | ||
'signed-url', help=generate_signed_url.__doc__) | ||
signed_url_parser.add_argument('blob_name') | ||
|
||
signed_url_download_v4_parser = subparsers.add_parser( |
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.
Calling the generate signed URL should be added to the switch statement below.
storage/cloud-client/snippets.py
Outdated
print(url) | ||
print('You can use this URL with any user agent, for example:') | ||
print("curl -X PUT -H 'Content-Type: application/octet-stream' " | ||
"--upload-file my-file \'{}\''.format(url)") |
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.
I think this line will have issues with format() as it's part of the double quoted string.
not sure how to fix this.. |
Reading more on it here: https://lintlyci.github.io/Flake8Rules/rules/C901.html @engelke do you have any tips on this? |
A guess. There are several if statements in a row, so it will check them
all even after one is matched. Make them elif instead. Also, maybe move the
body of the if __name__ == main to a function named main.
*From: *Frank Natividad <notifications@github.com>
*Date: *Wed, May 8, 2019, 1:37 PM
*To: *GoogleCloudPlatform/python-docs-samples
*Cc: *Charles Engelke, Mention
Reading more on it here:
… https://lintlyci.github.io/Flake8Rules/rules/C901.html
@engelke <https://github.com/engelke> do you have any tips on this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2142 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAT6NYBN3BWNQSFSMSTZZLPUM2XXANCNFSM4HLEJTCQ>
.
|
Looks like it's passing now :) |
Thanks @jkwlui! |
No description provided.