File tree Expand file tree Collapse file tree 4 files changed +11
-3
lines changed
packages/create-cloudflare/templates
hello-world-durable-object-with-assets/py/src
hello-world-durable-object/py/src
hello-world-with-assets/py/src Expand file tree Collapse file tree 4 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " create-cloudflare " : minor
3+ ---
4+
5+ Add @handler to Python templates.
Original file line number Diff line number Diff line change 1- from workers import DurableObject , Response
1+ from workers import DurableObject , Response , handler
22
33"""
44 * Welcome to Cloudflare Workers! This is your first Durable Objects application.
@@ -48,6 +48,7 @@ async def say_hello(self, name):
4848* @param {ExecutionContext} ctx - The execution context of the Worker
4949* @returns {Promise<Response>} The response to be sent back to the client
5050"""
51+ @handler
5152async def on_fetch (request , env , ctx ):
5253 # Create a `DurableObjectId` for an instance of the `MyDurableObject`
5354 # class named "foo". Requests from all Workers to the instance named
Original file line number Diff line number Diff line change 1- from workers import DurableObject , Response
1+ from workers import DurableObject , Response , handler
22
33"""
44 * Welcome to Cloudflare Workers! This is your first Durable Objects application.
@@ -48,6 +48,7 @@ async def say_hello(self, name):
4848* @param {ExecutionContext} ctx - The execution context of the Worker
4949* @returns {Promise<Response>} The response to be sent back to the client
5050"""
51+ @handler
5152async def on_fetch (request , env , ctx ):
5253 # Create a `DurableObjectId` for an instance of the `MyDurableObject`
5354 # class named "foo". Requests from all Workers to the instance named
Original file line number Diff line number Diff line change 1- from workers import Response
1+ from workers import Response , handler
22from uuid import uuid4
33from urllib .parse import urlparse
44
5+ @handler
56async def on_fetch (request , env ):
67 url = urlparse (request .url )
78 if url .path == '/message' :
You can’t perform that action at this time.
0 commit comments