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

docs: add docs signed_url expiration take default utc #250

Merged
merged 9 commits into from Aug 27, 2020

Conversation

@HemangChothani
Copy link
Contributor

@HemangChothani HemangChothani commented Aug 19, 2020

Fixes #244

@HemangChothani HemangChothani requested a review from tseaver Aug 19, 2020
@google-cla google-cla bot added the cla: yes label Aug 19, 2020
Copy link
Contributor

@tseaver tseaver left a comment

Please change all the docstrings as noted in my first comment.

:param expiration: Point in time when the signed URL should expire.
:param expiration: Point in time when the signed URL should expire. If
expiration in datetime, then need to pass timezone
with it. Default value of ``tzinfo`` is ``UTC``.
Copy link
Contributor

@tseaver tseaver Aug 19, 2020

The default value of the tzinfo argument to datetime.datetime is None, resulting in a "naive" datetime instance: the comment should state clearly that we forcibly convert such instances to UTC. E.g.:

    :param expiration: Point in time when the signed URL should expire. If
                       a `datetime` instance is passed without an explicit
                      `tzinfo` set,  it will be converted to ``UTC``.

Copy link
Contributor

@andrewsg andrewsg Aug 24, 2020

Rather than "it will be converted to" let's use "it will be assumed to be". This is a huge footgun; a user who sees the term "converted" will assume that we will do the right thing in the default case, whereas in fact we will almost always do the wrong thing.

Copy link
Contributor

@andrewsg andrewsg left a comment

As per the original issue, can we also modify the system test TestV4POSTPolicies.test_get_signed_policy_v4() to use utcnow()?

@andrewsg
Copy link
Contributor

@andrewsg andrewsg commented Aug 24, 2020

Cancel that, I just saw that the test issue is resolved in #251. Thanks for that! Leaving review on "changes requested" for the docstring update as per my comment; lgtm other than that.

Copy link
Contributor

@andrewsg andrewsg left a comment

Thanks!

google/cloud/storage/_signing.py Outdated Show resolved Hide resolved
google/cloud/storage/_signing.py Outdated Show resolved Hide resolved
google/cloud/storage/_signing.py Outdated Show resolved Hide resolved
google/cloud/storage/_signing.py Outdated Show resolved Hide resolved
google/cloud/storage/blob.py Outdated Show resolved Hide resolved
google/cloud/storage/bucket.py Outdated Show resolved Hide resolved
google/cloud/storage/client.py Outdated Show resolved Hide resolved
@tseaver
Copy link
Contributor

@tseaver tseaver commented Aug 26, 2020

@HemangChothani I would merge my suggestions to address the concern expressed by @andrewsg , but you have the "maintainers can push changes" option turned off.

@tseaver tseaver merged commit 944ab18 into googleapis:master Aug 27, 2020
4 checks passed
@IlyaFaer IlyaFaer deleted the storage_issue_244 branch Sep 10, 2020
cojenco added a commit to cojenco/python-storage that referenced this issue Oct 13, 2021
Co-authored-by: Frank Natividad <frankyn@users.noreply.github.com>
Co-authored-by: Tres Seaver <tseaver@palladion.com>
cojenco added a commit to cojenco/python-storage that referenced this issue Oct 13, 2021
Co-authored-by: Frank Natividad <frankyn@users.noreply.github.com>
Co-authored-by: Tres Seaver <tseaver@palladion.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants