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

Function get_echo

tests/unit/server.py:346–368  ·  view source on GitHub ↗

Echo back GET request details similar to httpbin.org/get.

(scope: dict[str, Any], _receive: Receive, send: Send)

Source from the content-addressed store, hash-verified

344
345
346async def get_echo(scope: dict[str, Any], _receive: Receive, send: Send) -> None:
347 """Echo back GET request details similar to httpbin.org/get."""
348 path = scope.get('path', '')
349 query_string = scope.get('query_string', b'')
350 args = get_query_params(query_string)
351 headers = get_headers_dict(scope)
352
353 origin = scope.get('client', ('unknown', 0))[0]
354
355 host = headers.get('host', 'localhost')
356 scheme = headers.get('x-forwarded-proto', 'http')
357 url = f'{scheme}://{host}{path}'
358 if query_string:
359 url += f'?{query_string}'
360
361 response = {
362 'args': args,
363 'headers': headers,
364 'origin': origin,
365 'url': url,
366 }
367
368 await send_json_response(send, response)
369
370
371async def set_complex_cookies(_scope: dict[str, Any], _receive: Receive, send: Send) -> None:

Callers

nothing calls this directly

Calls 3

get_query_paramsFunction · 0.85
get_headers_dictFunction · 0.85
send_json_responseFunction · 0.85

Tested by

no test coverage detected