cloudflare · Cloudflare Workers Docs
Workers The Basics
Teaches how to implement a basic Python Worker by defining a fetch handler within a Default class, accessing the Request interface via FFI, utilizing the env attribute for environment variables, and structuring code a...
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Workers The Basics
Teaches how to implement a basic Python Worker by defining a fetch handler within a Default class, accessing the Request interface via FFI, utilizing the env attribute for environment variables, and structuring code a...
When To Use
Use when you need to implement a basic Python-based Cloudflare Worker, handle incoming HTTP requests, access environment variables, or organize worker code into multiple files.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-python-basics-the-workflow-guide.md | A guide covering the fetch handler, request interface, env attribute, and modules for Python Workers. | Questions about a guide covering the fetch handler, request interface, env attribute, and modules for Python Workers. |
examples/workers-python-basics-the-cloudflare-workers-python-basics-hello-world.text | A basic Python implementation of a Cloudflare Worker using the WorkerEntrypoint class to return a Hello World response. | Exact payloads, commands, or snippets shown in A basic Python implementation of a Cloudflare Worker using the WorkerEntrypoint class to return a Hello World response. |
examples/workers-python-basics-the-cloudflare-workers-python-basics-entrypoint.text | A Python code example demonstrating how to implement a WorkerEntrypoint and handle a fetch request in a Cloudflare Worker. | Exact payloads, commands, or snippets shown in A Python code example demonstrating how to implement a WorkerEntrypoint and handle a fetch request in a Cloudflare Wo... |
examples/workers-python-basics-the-cloudflare-workers-python-basics-curl-request.text | A curl command demonstrating how to send a POST request with a JSON payload to a local Cloudflare Workers Python environment. | Exact payloads, commands, or snippets shown in A curl command demonstrating how to send a POST request with a JSON payload to a local Cloudflare Workers Python envi... |
examples/workers-python-basics-the-cloudflare-workers-python-hello-world.text | A basic Python script for a Cloudflare Worker that returns a 'Hello, Python!' response. | Exact payloads, commands, or snippets shown in A basic Python script for a Cloudflare Worker that returns a 'Hello, Python!' response. |
examples/workers-python-basics-the-cloudflare-workers-python-basics-wrangler-toml.text | A wrangler.toml configuration file for a Python-based Cloudflare Worker including compatibility flags and environment variables. | Exact payloads, commands, or snippets shown in A wrangler.toml configuration file for a Python-based Cloudflare Worker including compatibility flags and environment... |
examples/workers-python-basics-the-cloudflare-workers-python-wrangler-toml-config.text | A wrangler.toml configuration file for a Python-based Cloudflare Worker including schema references and compatibility flags. | Exact payloads, commands, or snippets shown in A wrangler.toml configuration file for a Python-based Cloudflare Worker including schema references and compatibility... |
examples/workers-python-basics-the-cloudflare-workers-python-basics-entrypoint-2.text | A Python code example demonstrating how to implement a basic WorkerEntrypoint class with a fetch method. | Exact payloads, commands, or snippets shown in A Python code example demonstrating how to implement a basic WorkerEntrypoint class with a fetch method. |
examples/workers-python-basics-the-cloudflare-workers-python-hello-world-2.text | A basic Python function implementation for a Cloudflare Worker that returns a greeting string. | Exact payloads, commands, or snippets shown in A basic Python function implementation for a Cloudflare Worker that returns a greeting string. |
examples/workers-python-basics-the-cloudflare-workers-python-basics-entrypoint-3.text | A Python implementation of a Cloudflare Worker using the WorkerEntrypoint class to handle fetch requests. | Exact payloads, commands, or snippets shown in A Python implementation of a Cloudflare Worker using the WorkerEntrypoint class to handle fetch requests. |
examples/workers-python-basics-the-cloudflare-workers-python-basics-dependency-gr.text | A text snippet showing the dependency-groups configuration for a Cloudflare Workers Python project including workers-py and workers-runtime-sdk. | Exact payloads, commands, or snippets shown in A text snippet showing the dependency-groups configuration for a Cloudflare Workers Python project including workers-... |
examples/workers-python-basics-the-cloudflare-workers-python-basics-uv-tool-upgra.text | A command to upgrade the workers-py tool using the uv package manager. | Exact payloads, commands, or snippets shown in A command to upgrade the workers-py tool using the uv package manager. |
examples/workers-python-basics-the-cloudflare-workers-python-uv-lock-upgrade-comm.text | A text snippet demonstrating the command to upgrade the workers-py package using the uv package manager. | Exact payloads, commands, or snippets shown in A text snippet demonstrating the command to upgrade the workers-py package using the uv package manager. |
What This Skill Covers
- As mentioned in the introduction to Python Workers, a Python Worker can be as simple as four lines of code:
- Main sections:
Fetch Handler,The Request Interface,The env Attribute,Modules,Types and Autocompletion.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.cloudflare.com/workers/languages/python/basics
