Skip to content

Python scraper based on AI

raise keyerror exception for the schema

Marco Vinciguerra657ef711f75d
diff --git a/scrapegraphai/graphs/code_generator_graph.py b/scrapegraphai/graphs/code_generator_graph.py
index 5da82794..ca763896 100644
--- a/scrapegraphai/graphs/code_generator_graph.py
+++ b/scrapegraphai/graphs/code_generator_graph.py
@@ -63,6 +63,9 @@ class CodeGeneratorGraph(AbstractGraph):
BaseGraph: A graph instance representing the web scraping workflow.
"""
+ if self.schema is None:
+ raise KeyError("The schema is required for CodeGeneratorGraph")
+
fetch_node = FetchNode(
input="url| local_dir",
output=["doc"],