Skip to content

Add R2 example - #1

Closed
adewale wants to merge 1 commit into
add-sync-http-clients-examplefrom
add-r2-example
Closed

Add R2 example#1
adewale wants to merge 1 commit into
add-sync-http-clients-examplefrom
add-r2-example

Conversation

@adewale

@adewale adewale commented May 2, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a Python Workers example for core Cloudflare R2 Workers API operations.

The example demonstrates:

  • object upload/download with put(), get(), and head()
  • direct request ReadableStream uploads to R2
  • direct R2 ReadableStream responses without copying large objects through Python memory
  • range reads
  • HTTP metadata and custom metadata
  • conditional read/write headers
  • checksum and storage class options
  • listing with prefix, limit, cursor, delimiter, and include
  • single-key and batch deletes
  • multipart upload create/upload/complete/abort using ?key= so keys with slashes work
  • shared large-file fixture routes for future examples

Stack

This PR is stacked on top of cloudflare#79 (16-sync-http-clients). The diff against add-sync-http-clients-example contains only the R2 example changes.

Tests

python3 -m py_compile 17-r2/src/entry.py
uv run pytest tests/test_examples.py::test_17_r2 -q
uv run ruff check 17-r2 tests/test_examples.py
@adewale

adewale commented May 2, 2026

Copy link
Copy Markdown
Owner Author

Closing this stacked fork PR. Reopening as a normal upstream PR that notes its dependency on cloudflare#79.

@adewale adewale closed this May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant