Call the scrapegraph-py scrape endpoint across SDK versions.
(api_key: Optional[str], url: str)
| 78 | |
| 79 | |
| 80 | def scrape(api_key: Optional[str], url: str) -> dict: |
| 81 | """Call the scrapegraph-py scrape endpoint across SDK versions.""" |
| 82 | api = _detect_api() |
| 83 | |
| 84 | if api == "v3": |
| 85 | from scrapegraph_py import ScrapeGraphAI, ScrapeRequest |
| 86 | |
| 87 | with ScrapeGraphAI(api_key=api_key) as client: |
| 88 | return _unwrap_result(client.scrape(ScrapeRequest(url=url))) |
| 89 | |
| 90 | from scrapegraph_py import Client |
| 91 | |
| 92 | with Client(api_key=api_key) as client: |
| 93 | return client.scrape(url=url) |
| 94 | |
| 95 | |
| 96 | def search(api_key: Optional[str], query: str) -> dict: |
nothing calls this directly
no test coverage detected