feat: add Python HTTP client examplefeat: add Python HTTP client example#30
Open
Sertug17 wants to merge 2 commits intoshelby:mainfrom
Open
feat: add Python HTTP client examplefeat: add Python HTTP client example#30Sertug17 wants to merge 2 commits intoshelby:mainfrom
Sertug17 wants to merge 2 commits intoshelby:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| print(f"[shelby] Uploading {file_path} ({len(data):,} bytes) -> {blob_name}") | ||
| if len(data) > multipart_threshold: | ||
| return self.upload_multipart(account, blob_name, data, verbose=verbose) | ||
| return self.upload(account, blob_name, data) |
There was a problem hiding this comment.
upload_file loads entire large file into memory
Low Severity
upload_file reads the entire file into memory with f.read() before deciding whether to use multipart upload. Since multipart upload is specifically intended for large files (those exceeding the 5 MB multipart_threshold), this means the exact files meant to benefit from chunked uploading are fully loaded into memory first. For very large files, this can cause MemoryError or excessive memory usage, undermining the stated "chunked upload for large files" feature.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Adds a Python HTTP client example for the Shelby Protocol RPC API.
The TypeScript SDK covers Node.js and browser environments well, but Python is widely used in AI/ML and data engineering pipelines — exactly the workloads Shelby targets.
What's included
shelby/client.py— ShelbyClient with upload, multipart upload, download, byte-range reads, and session supportexamples/01_basic_upload_download.py— simple upload & downloadexamples/02_multipart_upload.py— chunked upload for large filesexamples/03_byte_range_download.py— partial reads for AI/streaming use casesDependencies
Only
requests— no other dependencies.Note
Low Risk
Adds a new, self-contained Python client and examples without modifying existing production paths; risk is mainly around correctness of HTTP request/response handling against the Shelby API.
Overview
Introduces a new
apps/python-http-clientpackage implementing a lightweight PythonShelbyClienton top of the Shelby RPC HTTP API, including single-shot uploads, multipart uploads, byte-range downloads, and micropayment session consumption.Adds runnable example scripts plus a README and minimal dependency setup (
requestsviarequirements.txt) to document and demonstrate common upload/download workflows.Written by Cursor Bugbot for commit 19942a0. This will update automatically on new commits. Configure here.