refactor(mcp)!: Cleaning and unifying functions to async

- `get()` now delegates to `bulk_get([url])[0]` (was a separate sync implementation)
- `fetch()` now delegates to `bulk_fetch([url])[0]` (eliminated duplicate fetcher call)
- `stealthy_fetch()` now delegates to `bulk_stealthy_fetch([url])[0]` (same)
- Replaced 6x repeated `_content_translator(Convertor._extract_content(...), page)` with a single `_translate_response()` helper
- Removed unused imports (`Fetcher`, `DynamicFetcher`, `StealthyFetcher`, `Generator`)
This commit is contained in:
Karim shoair
2026-03-27 19:30:58 +02:00
parent 8e147db7f8
commit a356dd2f2b
2 changed files with 75 additions and 116 deletions
+3 -2
View File
@@ -16,9 +16,10 @@ class TestMCPServer:
def server(self):
return ScraplingMCPServer()
def test_get_tool(self, server, test_url):
@pytest.mark.asyncio
async def test_get_tool(self, server, test_url):
"""Test the get tool method"""
result = server.get(url=test_url, extraction_type="markdown")
result = await server.get(url=test_url, extraction_type="markdown")
assert isinstance(result, ResponseModel)
assert result.status == 200
assert result.url == test_url