Skip to content

Commit ce02854

Browse files
committed
feat: refctoring of the folder
1 parent 96b431d commit ce02854

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
from scrapegraph_py import ScrapeGraphClient, scrape
2+
from scrapegraph_py import ScrapeGraphClient, smart_scraper
33
from dotenv import load_dotenv
44

55
load_dotenv()
@@ -9,5 +9,5 @@
99
url = "https://scrapegraphai.com/"
1010
prompt = "What does the company do?"
1111

12-
result = scrape(client, url, prompt)
12+
result = smart_scraper(client, url, prompt)
1313
print(result)

scrapegraph-py/examples/scrape_schema_example.py renamed to scrapegraph-py/examples/smart_scraper_schema_example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
from pydantic import BaseModel, Field
3-
from scrapegraph_py import ScrapeGraphClient, scrape
3+
from scrapegraph_py import ScrapeGraphClient, smart_scraper
44
from dotenv import load_dotenv
55

66
load_dotenv()
@@ -19,5 +19,5 @@ class CompanyInfoSchema(BaseModel):
1919
prompt = "What does the company do?"
2020

2121
# Call the scrape function with the schema
22-
result = scrape(client=client, url=url, prompt=prompt, schema=CompanyInfoSchema)
22+
result = smart_scraper(client=client, url=url, prompt=prompt, schema=CompanyInfoSchema)
2323
print(result)
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
"""
2+
ScrapeGraph Package
3+
4+
This package provides tools for web scraping and data extraction, including:
5+
6+
- ScrapeGraphClient: A client for interacting with the ScrapeGraph API.
7+
- smart_scraper: A utility for intelligent web scraping.
8+
- credits: Module for handling credits and usage.
9+
- feedback: Module for collecting and managing user feedback.
10+
"""
11+
112
from .client import ScrapeGraphClient
2-
from .scrape import scrape
13+
from .smart_scraper import smart_scraper
314
from .credits import credits
4-
from .feedback import feedback
15+
from .feedback import feedback

scrapegraph-py/scrapegraph_py/scrape.py renamed to scrapegraph-py/scrapegraph_py/smart_scraper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
from .client import ScrapeGraphClient
1717
from .exceptions import APIError, raise_for_status_code
1818

19-
def scrape(client: ScrapeGraphClient, url: str, prompt: str,
19+
def smart_scraper(client: ScrapeGraphClient, url: str, prompt: str,
2020
schema: Optional[BaseModel] = None) -> str:
21-
"""Scrape and extract structured data from a webpage using ScrapeGraph AI.
21+
"""smart_scraper and extract structured data from a webpage using ScrapeGraph AI.
2222
2323
Args:
2424
client (ScrapeGraphClient): Initialized ScrapeGraph client

0 commit comments

Comments
 (0)