Skip to content

Commit

Permalink
Fix python code in Hello World page
Browse files Browse the repository at this point in the history
Signed-off-by: TEDmk <teddy.turquet@protonmail.com>
  • Loading branch information
TEDmk authored and lachieh committed Mar 22, 2024
1 parent f1c52a7 commit 9b06453
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions versioned_docs/version-0.82/tour/hello-world.mdx
Expand Up @@ -362,18 +362,18 @@ This actor has a single function, `handle`, that implements the `incoming-handle
from hello import exports
from hello.types import Ok
from hello.imports.types import (
IncomingRequest, ResponseOutparam,
OutgoingResponse, Fields, OutgoingBody
IncomingRequest, ResponseOutparam,
OutgoingResponse, Fields, OutgoingBody
)

class IncomingHandler(exports.IncomingHandler):
def handle(self, \_: IncomingRequest, response_out: ResponseOutparam): # Construct the HTTP response to send back
outgoingResponse = OutgoingResponse(Fields.from_list([])) # Set the status code to OK
outgoingResponse.set_status_code(200)
outgoingBody = outgoingResponse.body() # Write our Hello World message to the response body
outgoingBody.write().blocking_write_and_flush(bytes("Hello from Python!\n", "utf-8"))
OutgoingBody.finish(outgoingBody, None) # Set and send the HTTP response
ResponseOutparam.set(response_out, Ok(outgoingResponse))
def handle(self, _: IncomingRequest, response_out: ResponseOutparam): # Construct the HTTP response to send back
outgoingResponse = OutgoingResponse(Fields.from_list([])) # Set the status code to OK
outgoingResponse.set_status_code(200)
outgoingBody = outgoingResponse.body() # Write our Hello World message to the response body
outgoingBody.write().blocking_write_and_flush(bytes("Hello from Python!\n", "utf-8"))
OutgoingBody.finish(outgoingBody, None) # Set and send the HTTP response
ResponseOutparam.set(response_out, Ok(outgoingResponse))

````

Expand Down

0 comments on commit 9b06453

Please sign in to comment.