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

Function send_request

tests/unit/_utils/test_sitemap.py:29–38  ·  view source on GitHub ↗
(url: str, **_kwargs: Any)

Source from the content-addressed store, hash-verified

27
28def _make_mock_client(url_map: dict[str, tuple[int, bytes]]) -> AsyncMock:
29 async def send_request(url: str, **_kwargs: Any) -> HttpResponse:
30 status, body = 404, b''
31 for pattern, (s, b) in url_map.items():
32 if pattern in url:
33 status, body = s, b
34 break
35 response = MagicMock(spec=HttpResponse)
36 response.status_code = status
37 response.read = AsyncMock(return_value=body)
38 return response
39
40 client = AsyncMock(spec=HttpClient)
41 client.send_request.side_effect = send_request

Callers

nothing calls this directly

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected