Prompt Buddy logoPrompt Buddy

cloudflare · Cloudflare Workers Docs

Workers Examples

A collection of Python code implementations for common Cloudflare Workers tasks including module imports, request parsing, file system access, logging, queue publishing, and database querying.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Workers Examples

A collection of Python code implementations for common Cloudflare Workers tasks including module imports, request parsing, file system access, logging, queue publishing, and database querying.

When To Use

Use when you need to implement specific Python patterns for handling requests, interacting with Cloudflare bindings like D1 or Queues, or managing module structures within a Worker environment.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-python-examples-workflow-guide.mdA collection of Python code examples demonstrating common Cloudflare Workers tasks such as parsing request URLs, handling JSON, and reading bundled assets.Questions about a collection of Python code examples demonstrating common Cloudflare Workers tasks such as parsing request URLs, hand...
examples/workers-python-examples-cloudflare-workers-python-project-structure.textA directory tree structure showing the file layout for a Cloudflare Workers Python project including pyproject.toml and wrangler.toml.Exact payloads, commands, or snippets shown in A directory tree structure showing the file layout for a Cloudflare Workers Python project including pyproject.toml a...
examples/workers-python-examples-cloudflare-workers-python-examples.textA collection of Python code examples demonstrating various implementation patterns for Cloudflare Workers.Exact payloads, commands, or snippets shown in A collection of Python code examples demonstrating various implementation patterns for Cloudflare Workers.
examples/workers-python-examples-cloudflare-workers-python-main-src-template.textA template showing the standard main entry point structure for a Cloudflare Workers Python script.Exact payloads, commands, or snippets shown in A template showing the standard main entry point structure for a Cloudflare Workers Python script.
examples/workers-python-examples-cloudflare-workers-python-workerentrypoint-fetch.textA Python implementation of a Cloudflare Workers Entrypoint using the fetch method to parse request URLs and query parameters.Exact payloads, commands, or snippets shown in A Python implementation of a Cloudflare Workers Entrypoint using the fetch method to parse request URLs and query par...
examples/workers-python-examples-cloudflare-workers-python-workerentrypoint-fetch-2.textA Python implementation of a Cloudflare Workers entrypoint using the WorkerEntrypoint class to handle fetch requests.Exact payloads, commands, or snippets shown in A Python implementation of a Cloudflare Workers entrypoint using the WorkerEntrypoint class to handle fetch requests.
examples/workers-python-examples-cloudflare-workers-python-project-structure-2.textA directory tree structure showing the file organization for a Cloudflare Workers Python project including src and wrangler.jsonc.Exact payloads, commands, or snippets shown in A directory tree structure showing the file organization for a Cloudflare Workers Python project including src and wr...
examples/workers-python-examples-cloudflare-workers-python-entrypoint-reading.textA Python example demonstrating how to use the WorkerEntrypoint class to read and return a local HTML file as a response.Exact payloads, commands, or snippets shown in A Python example demonstrating how to use the WorkerEntrypoint class to read and return a local HTML file as a response.
examples/workers-python-examples-cloudflare-workers-python-console-api.textA Python script demonstrating how to use JavaScript console APIs within a Cloudflare Workers environment.Exact payloads, commands, or snippets shown in A Python script demonstrating how to use JavaScript console APIs within a Cloudflare Workers environment.
examples/workers-python-examples-cloudflare-workers-python-workerentrypoint-fetch-3.textA Python implementation of a Cloudflare Worker using the WorkerEntrypoint class to handle fetch requests and convert data between Python and JavaScript.Exact payloads, commands, or snippets shown in A Python implementation of a Cloudflare Worker using the WorkerEntrypoint class to handle fetch requests and convert...
examples/workers-python-examples-cloudflare-workers-python-workerentrypoint-db-qu.textA Python example demonstrating how to use the WorkerEntrypoint class to execute a SQL query against a D1 database and return a JSON response.Exact payloads, commands, or snippets shown in A Python example demonstrating how to use the WorkerEntrypoint class to execute a SQL query against a D1 database and...
examples/workers-python-examples-cloudflare-workers-python-durable-objects.textA Python implementation of a Cloudflare Workers Durable Object that manages a list of messages using persistent storage.Exact payloads, commands, or snippets shown in A Python implementation of a Cloudflare Workers Durable Object that manages a list of messages using persistent storage.
examples/workers-python-examples-cloudflare-workers-python-scheduled-event.textA Python implementation of a Cloudflare Workers scheduled event handler using the WorkerEntrypoint class.Exact payloads, commands, or snippets shown in A Python implementation of a Cloudflare Workers scheduled event handler using the WorkerEntrypoint class.
examples/workers-python-examples-cloudflare-workers-python-workflow-entrypoint.textA Python code example demonstrating how to implement a WorkflowEntrypoint using the workers library with concurrent steps.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to implement a WorkflowEntrypoint using the workers library with concurrent s...
examples/workers-python-examples-cloudflare-workers-python-examples-repository-cl.textThe git clone command used to retrieve the official Cloudflare Workers Python examples repository.Exact payloads, commands, or snippets shown in The git clone command used to retrieve the official Cloudflare Workers Python examples repository.

What This Skill Covers

  • Cloudflare has a wide range of Python examples in the Workers Example gallery.
  • Main sections: Modules in your Worker, Parse an incoming request URL, Parse JSON from the incoming request, Read bundled asset files in your Worker, Emit logs from your Python Worker.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://developers.cloudflare.com/workers/languages/python/examples