Conversation
The get() method recently changed from returning raw bytes to returning a GetBlobResult envelope. Adding __bytes__ lets consumers use bytes(result) idiomatically instead of reaching into the .content property, easing the migration.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds a __bytes__ implementation to GetBlobResult so callers can use bytes(result) as an ergonomic migration path now that get() returns an envelope object instead of raw bytes.
Changes:
- Add
GetBlobResult.__bytes__()returningcontent. - Update the blob storage example to use
bytes(result)instead ofresult.content.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/vercel/blob/types.py |
Introduces __bytes__ on GetBlobResult to support bytes(result) conversions. |
examples/blob_storage.py |
Demonstrates the new bytes(result) usage in the get() example output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def __bytes__(self) -> bytes: | ||
| return self.content |
There was a problem hiding this comment.
__bytes__ is a new public behavior on GetBlobResult, but there’s no unit test asserting bytes(result) returns the response content (and works for both 200 and 304 cases). Adding a small assertion in the existing _build_get_result tests would prevent regressions and validate the intended migration path.
There was a problem hiding this comment.
Examples are run as tests, so this is covered.
The
get()method recently changed from returning raw bytes to returning aGetBlobResultenvelope. Adding__bytes__lets consumers usebytes(result)idiomatically instead of reaching into the.contentproperty, easing the migration.