Skip to content

Python HL SDK: pre-signed urls in stat() #9180

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 1 commit into from
Jun 13, 2025
Merged

Conversation

ozkatz
Copy link
Collaborator

@ozkatz ozkatz commented Jun 12, 2025

Partially closes #9070 (pre-signed URLs only for now)

@ozkatz ozkatz requested a review from N-o-Z June 12, 2025 21:07
@ozkatz ozkatz self-assigned this Jun 12, 2025
@ozkatz ozkatz added include-changelog PR description should be included in next release changelog python-wrapper labels Jun 12, 2025
@ozkatz ozkatz requested a review from nopcoder June 12, 2025 21:07
@@ -676,13 +676,15 @@ def reader(self, mode: ReadModes = 'rb', pre_sign: Optional[bool] = None) -> Obj
"""
return ObjectReader(self, mode=mode, pre_sign=pre_sign, client=self._client)

def stat(self) -> ObjectInfo:
def stat(self, pre_sign: Optional[bool] = None) -> ObjectInfo:
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Because we use named parameters, consider using the name param name 'presign'.
  2. Why not include user metadata and close the issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

convolutes the caching behavior. If I cached an object with no user_metadata and now I request it with user_metadata, I need to make sure not to use the cached version (and vice versa).

As for pre_sign vs presign - I decided to adopt the style of the surrounding code (see for example the reader() method above)

"""
Return the Stat object representing this object
"""
if self._stats is None:
# don't cache pre-signed stats
Copy link
Contributor

Choose a reason for hiding this comment

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

Q. did we had a requirement to add caching? it works for a single app, but any change from outside the app will make this case invalid. it is also true for committed data if we enable retention.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe it was added because there are access patterns that might stat frequently. I'm ok with revisiting this decision but maybe not as part of this PR :)

@ozkatz ozkatz requested a review from nopcoder June 12, 2025 21:27
@ozkatz ozkatz merged commit 1666878 into master Jun 13, 2025
46 checks passed
@ozkatz ozkatz deleted the feat/python-stat-with-params branch June 13, 2025 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include-changelog PR description should be included in next release changelog python-wrapper
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python HL SDK: enable object stat API request user metadata and presign
2 participants