Skip to content

feat: add Python HTTP client examplefeat: add Python HTTP client example#30

Open
Sertug17 wants to merge 2 commits intoshelby:mainfrom
Sertug17:feat/python-http-client
Open

feat: add Python HTTP client examplefeat: add Python HTTP client example#30
Sertug17 wants to merge 2 commits intoshelby:mainfrom
Sertug17:feat/python-http-client

Conversation

@Sertug17
Copy link

@Sertug17 Sertug17 commented Mar 12, 2026

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 support
  • examples/01_basic_upload_download.py — simple upload & download
  • examples/02_multipart_upload.py — chunked upload for large files
  • examples/03_byte_range_download.py — partial reads for AI/streaming use cases

Dependencies

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-client package implementing a lightweight Python ShelbyClient on 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 (requests via requirements.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.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

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)
Copy link

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant