Skip to content

Commit 5d37063

Browse files
committed
feat: add async examples directly to each service
1 parent ec4a8e0 commit 5d37063

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

services/localscraper.mdx

+32
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,38 @@ const response = await localScraper(
161161

162162
</CodeGroup>
163163

164+
### Async Support
165+
166+
For applications requiring asynchronous execution, LocalScraper provides async support through the `AsyncClient`:
167+
168+
```python
169+
from scrapegraph_py import AsyncClient
170+
import asyncio
171+
172+
async def main():
173+
html_content = """
174+
<html>
175+
<body>
176+
<h1>Product: Gaming Laptop</h1>
177+
<div class="price">$999.99</div>
178+
<div class="description">
179+
High-performance gaming laptop with RTX 3080.
180+
</div>
181+
</body>
182+
</html>
183+
"""
184+
185+
async with AsyncClient(api_key="your-api-key") as client:
186+
response = await client.localscraper(
187+
website_html=html_content,
188+
user_prompt="Extract the product information"
189+
)
190+
print(response)
191+
192+
# Run the async function
193+
asyncio.run(main())
194+
```
195+
164196
## Integration Options
165197

166198
### Official SDKs

services/markdownify.mdx

+19
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,25 @@ The response includes:
8989
- `error`: Error message (if any occurred during conversion)
9090
</Accordion>
9191

92+
### Async Support
93+
94+
For applications requiring asynchronous execution, Markdownify provides async support through the `AsyncClient`:
95+
96+
```python
97+
from scrapegraph_py import AsyncClient
98+
import asyncio
99+
100+
async def main():
101+
async with AsyncClient(api_key="your-api-key") as client:
102+
response = await client.markdownify(
103+
website_url="https://example.com/article"
104+
)
105+
print(response)
106+
107+
# Run the async function
108+
asyncio.run(main())
109+
```
110+
92111
## Integration Options
93112

94113
### Official SDKs

services/smartscraper.mdx

+20
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,26 @@ const response = await smartScraper(
149149

150150
</CodeGroup>
151151

152+
### Async Support
153+
154+
For applications requiring asynchronous execution, SmartScraper provides async support through the `AsyncClient`:
155+
156+
```python
157+
from scrapegraph_py import AsyncClient
158+
import asyncio
159+
160+
async def main():
161+
async with AsyncClient(api_key="your-api-key") as client:
162+
response = await client.smartscraper(
163+
website_url="https://example.com",
164+
user_prompt="Extract the main content"
165+
)
166+
print(response)
167+
168+
# Run the async function
169+
asyncio.run(main())
170+
```
171+
152172
## Integration Options
153173

154174
### Official SDKs

0 commit comments

Comments
 (0)