@@ -25,17 +25,19 @@ Official Python SDK for the ScrapeGraph AI API - Smart web scraping powered by A
2525pip install scrapegraph-py
2626```
2727
28- ### Using Poetry (Recommended)
28+ ### Using uv
29+
30+ We recommend using [ uv] ( https://docs.astral.sh/uv/ ) to install the dependencies and pre-commit hooks.
2931
3032```
31- # Install poetry if you haven't already
32- pip install poetry
33+ # Install uv if you haven't already
34+ pip install uv
3335
3436# Install dependencies
35- poetry install
37+ uv sync
3638
3739# Install pre-commit hooks
38- poetry run pre-commit install
40+ uv run pre-commit install
3941```
4042
4143## 🔧 Quick Start
@@ -51,15 +53,15 @@ from scrapegraph_py.logger import get_logger
5153logger = get_logger(level = " DEBUG" )
5254
5355# Initialize client
54- client = SyncClient(api_key = " sgai- your-api-key" )
56+ sgai_client = SyncClient(api_key = " your-api-key-here " )
5557
5658# Make a request
57- response = client .smartscraper(
59+ response = sgai_client .smartscraper(
5860 website_url = " https://example.com" ,
5961 user_prompt = " Extract the main heading and description"
6062)
6163
62- print (response)
64+ print (response[ " result " ] )
6365```
6466
6567## 🎯 Examples
@@ -71,12 +73,12 @@ import asyncio
7173from scrapegraph_py import AsyncClient
7274
7375async def main ():
74- async with AsyncClient(api_key = " sgai- your-api-key" ) as client :
75- response = await client .smartscraper(
76+ async with AsyncClient(api_key = " your-api-key-here " ) as sgai_client :
77+ response = await sgai_client .smartscraper(
7678 website_url = " https://example.com" ,
77- user_prompt = " Extract the main heading "
79+ user_prompt = " Summarize the main content "
7880 )
79- print (response)
81+ print (response[ " result " ] )
8082
8183asyncio.run(main())
8284```
@@ -92,12 +94,14 @@ class WebsiteData(BaseModel):
9294 title: str = Field(description = " The page title" )
9395 description: str = Field(description = " The meta description" )
9496
95- client = SyncClient(api_key = " sgai- your-api-key" )
96- response = client .smartscraper(
97+ sgai_client = SyncClient(api_key = " your-api-key-here " )
98+ response = sgai_client .smartscraper(
9799 website_url = " https://example.com" ,
98100 user_prompt = " Extract the title and description" ,
99101 output_schema = WebsiteData
100102)
103+
104+ print (response[" result" ])
101105```
102106</details >
103107
@@ -112,27 +116,24 @@ For detailed documentation, visit [docs.scrapegraphai.com](https://docs.scrapegr
1121161 . Clone the repository:
113117```
114118git clone https://github.com/ScrapeGraphAI/scrapegraph-sdk.git
115- cd scrapegraph-sdk
119+ cd scrapegraph-sdk/scrapegraph-py
116120```
117121
1181222 . Install dependencies:
119123```
120- poetry install
124+ uv sync
121125```
122126
1231273 . Install pre-commit hooks:
124128```
125- poetry run pre-commit install
129+ uv run pre-commit install
126130```
127131
128132### Running Tests
129133
130134```
131135# Run all tests
132- poetry run pytest
133-
134- # Run with coverage
135- poetry run pytest --cov=scrapegraph_py
136+ uv run pytest
136137
137138# Run specific test file
138139poetry run pytest tests/test_client.py
@@ -167,4 +168,4 @@ Contributions are welcome! Please feel free to submit a Pull Request. For major
167168
168169---
169170
170- Made with ❤️ by [ ScrapeGraph AI] ( https://scrapegraphai.com )
171+ Made with ❤️ by [ ScrapeGraph AI] ( https://scrapegraphai.com )
0 commit comments