Python scraper based on AI
Python ai-crawlerai-scrapingai-searchcrawlerdata-extractionfirecrawl-alternativelarge-language-modelllmmarkdownragscrapingscraping-pythonweb-crawlerweb-crawlersweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
Add a test that reproduces the error
Pedro Perez de Ayala03c89b0736b0
diff --git a/pyproject.toml b/pyproject.tomlindex af92ed87..4e642625 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -31,7 +31,8 @@ dependencies = ["async-timeout>=4.0.3","simpleeval>=1.0.0","jsonschema>=4.23.0",- "duckduckgo-search>=7.2.1"+ "duckduckgo-search>=7.2.1",+ "pydantic>=2.10.2",]readme = "README.md"diff --git a/tests/graphs/smart_scraper_openai_test.py b/tests/graphs/smart_scraper_openai_test.pyindex 90d6a7a7..cfe5cb2a 100644--- a/tests/graphs/smart_scraper_openai_test.py+++ b/tests/graphs/smart_scraper_openai_test.py@@ -6,6 +6,7 @@ import osimport pytestfrom dotenv import load_dotenv+from pydantic import BaseModelfrom scrapegraphai.graphs import SmartScraperGraph@@ -53,3 +54,27 @@ def test_get_execution_info(graph_config):graph_exec_info = smart_scraper_graph.get_execution_info()assert graph_exec_info is not None+++def test_get_execution_info_with_schema(graph_config):+ """Get the execution info with schema"""++ class ProjectSchema(BaseModel):+ title: str+ description: str++ class ProjectListSchema(BaseModel):+ projects: list[ProjectSchema]++ smart_scraper_graph = SmartScraperGraph(+ prompt="List me all the projects with their description.",+ source="https://perinim.github.io/projects/",+ config=graph_config,+ schema=ProjectListSchema,+ )++ smart_scraper_graph.run()++ graph_exec_info = smart_scraper_graph.get_execution_info()++ assert graph_exec_info is not Nonediff --git a/uv.lock b/uv.lockindex 4a3e6063..9ab0fd3e 100644--- a/uv.lock+++ b/uv.lock@@ -1,4 +1,5 @@version = 1+revision = 1requires-python = ">=3.10, <4.0"resolution-markers = ["python_full_version < '3.11' and sys_platform == 'darwin'",@@ -3377,7 +3378,7 @@ wheels = [[[package]]name = "scrapegraphai"-version = "1.40.1"+version = "1.43.0"source = { editable = "." }dependencies = [{ name = "async-timeout", version = "4.0.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },@@ -3395,6 +3396,7 @@ dependencies = [{ name = "langchain-openai" },{ name = "minify-html" },{ name = "playwright" },+ { name = "pydantic" },{ name = "python-dotenv" },{ name = "semchunk" },{ name = "simpleeval" },@@ -3456,6 +3458,7 @@ requires-dist = [{ name = "minify-html", specifier = ">=0.15.0" },{ name = "pillow", marker = "extra == 'ocr'", specifier = ">=10.4.0" },{ name = "playwright", specifier = ">=1.43.0" },+ { name = "pydantic", specifier = ">=2.10.2" },{ name = "python-dotenv", specifier = ">=1.0.1" },{ name = "semchunk", specifier = ">=2.2.0" },{ name = "simpleeval", specifier = ">=1.0.0" },@@ -3465,6 +3468,7 @@ requires-dist = [{ name = "tqdm", specifier = ">=4.66.4" },{ name = "undetected-playwright", specifier = ">=0.3.0" },]+provides-extras = ["burr", "docs", "ocr"][package.metadata.requires-dev]dev = [