File tree Expand file tree Collapse file tree 3 files changed +100
-68
lines changed Expand file tree Collapse file tree 3 files changed +100
-68
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ dependencies = [
4545 " googlesearch-python>=1.2.5" ,
4646 " simpleeval>=1.0.0" ,
4747 " async_timeout>=4.0.3" ,
48- " scrapegraph-py>=0.0.4 "
48+ " scrapegraph-py>=1.7.0 "
4949]
5050
5151license = " MIT"
Original file line number Diff line number Diff line change 44
55from typing import Optional
66from pydantic import BaseModel
7+ from scrapegraph_py import Client
8+ from scrapegraph_py .logger import sgai_logger
79from .base_graph import BaseGraph
810from .abstract_graph import AbstractGraph
911from ..nodes import (
1416 ConditionalNode ,
1517)
1618from ..prompts import REGEN_ADDITIONAL_INFO
17- from scrapegraph_py import SyncClient
1819
1920class SmartScraperGraph (AbstractGraph ):
2021 """
@@ -65,12 +66,23 @@ def _create_graph(self) -> BaseGraph:
6566 """
6667 if self .llm_model == "scrapegraphai/smart-scraper" :
6768
68- sgai_client = SyncClient ( api_key = self . config . get ( "api_key" ) )
69+ sgai_logger . set_logging ( level = "INFO" )
6970
71+ # Initialize the client with explicit API key
72+ sgai_client = Client (api_key = self .config .get ("api_key" ))
73+
74+ # SmartScraper request
7075 response = sgai_client .smartscraper (
7176 website_url = self .source ,
72- user_prompt = self .prompt
77+ user_prompt = self .prompt ,
7378 )
79+
80+ # Print the response
81+ print (f"Request ID: { response ['request_id' ]} " )
82+ print (f"Result: { response ['result' ]} " )
83+
84+ sgai_client .close ()
85+
7486 return response
7587
7688 fetch_node = FetchNode (
You can’t perform that action at this time.
0 commit comments