@@ -53,15 +53,15 @@ from scrapegraph_py.logger import get_logger
53
53
logger = get_logger(level = " DEBUG" )
54
54
55
55
# Initialize client
56
- client = SyncClient(api_key = " sgai- your-api-key" )
56
+ sgai_client = SyncClient(api_key = " your-api-key-here " )
57
57
58
58
# Make a request
59
- response = client .smartscraper(
59
+ response = sgai_client .smartscraper(
60
60
website_url = " https://example.com" ,
61
61
user_prompt = " Extract the main heading and description"
62
62
)
63
63
64
- print (response)
64
+ print (response[ " result " ] )
65
65
```
66
66
67
67
## 🎯 Examples
@@ -73,12 +73,12 @@ import asyncio
73
73
from scrapegraph_py import AsyncClient
74
74
75
75
async def main ():
76
- async with AsyncClient(api_key = " sgai- your-api-key" ) as client :
77
- response = await client .smartscraper(
76
+ async with AsyncClient(api_key = " your-api-key-here " ) as sgai_client :
77
+ response = await sgai_client .smartscraper(
78
78
website_url = " https://example.com" ,
79
- user_prompt = " Extract the main heading "
79
+ user_prompt = " Summarize the main content "
80
80
)
81
- print (response)
81
+ print (response[ " result " ] )
82
82
83
83
asyncio.run(main())
84
84
```
@@ -94,12 +94,14 @@ class WebsiteData(BaseModel):
94
94
title: str = Field(description = " The page title" )
95
95
description: str = Field(description = " The meta description" )
96
96
97
- client = SyncClient(api_key = " sgai- your-api-key" )
98
- response = client .smartscraper(
97
+ sgai_client = SyncClient(api_key = " your-api-key-here " )
98
+ response = sgai_client .smartscraper(
99
99
website_url = " https://example.com" ,
100
100
user_prompt = " Extract the title and description" ,
101
101
output_schema = WebsiteData
102
102
)
103
+
104
+ print (response[" result" ])
103
105
```
104
106
</details >
105
107
@@ -114,27 +116,24 @@ For detailed documentation, visit [docs.scrapegraphai.com](https://docs.scrapegr
114
116
1 . Clone the repository:
115
117
```
116
118
git clone https://github.com/ScrapeGraphAI/scrapegraph-sdk.git
117
- cd scrapegraph-sdk
119
+ cd scrapegraph-sdk/scrapegraph-py
118
120
```
119
121
120
122
2 . Install dependencies:
121
123
```
122
- poetry install
124
+ uv sync
123
125
```
124
126
125
127
3 . Install pre-commit hooks:
126
128
```
127
- poetry run pre-commit install
129
+ uv run pre-commit install
128
130
```
129
131
130
132
### Running Tests
131
133
132
134
```
133
135
# Run all tests
134
- poetry run pytest
135
-
136
- # Run with coverage
137
- poetry run pytest --cov=scrapegraph_py
136
+ uv run pytest
138
137
139
138
# Run specific test file
140
139
poetry run pytest tests/test_client.py
0 commit comments