MCPcopy Create free account
hub / github.com/apify/crawlee-python / send_json_response

Function send_json_response

tests/unit/server.py:71–80  ·  view source on GitHub ↗

Send a JSON response to the client.

(send: Send, data: Any, status: int = 200)

Source from the content-addressed store, hash-verified

69
70
71async def send_json_response(send: Send, data: Any, status: int = 200) -> None:
72 """Send a JSON response to the client."""
73 await send(
74 {
75 'type': 'http.response.start',
76 'status': status,
77 'headers': [[b'content-type', b'application/json']],
78 }
79 )
80 await send({'type': 'http.response.body', 'body': json.dumps(data, indent=2).encode()})
81
82
83async def send_html_response(send: Send, html_content: bytes, status: int = 200) -> None:

Callers 6

get_cookiesFunction · 0.85
hello_world_jsonFunction · 0.85
post_echoFunction · 0.85
echo_headersFunction · 0.85
echo_user_agentFunction · 0.85
get_echoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected