Official Python client for Search1API
Repo superagents-lab/search1api-python, read from GitHub 16 min ago. superagents-lab has not joined Take My Repo.
Breaking: extract() on Search1API and AsyncSearch1API requires the keyword arguments prompt and response_format, matching the API. response_format is typed as ExtractResponseFormat (in search1api.types): {"type": "json_schema", "json_schema": <your JSON Schema>}. The API never accepted a request without them; it now rejects one with 422 and an errors array instead of 400, which the client raises as UnprocessableEntityError. The bundled OpenAPI snapshot records the required fields, the request example and TARGET_BAD_REQUEST in failureCategory.
The X-Search1API-Client request header now reports the installed version (python/0.6.1); since 0.3.0 it had always said python/0.3.0. __version__ moved to search1api/_version.py (still exported as search1api.__version__) and a test keeps it equal to pyproject.toml. No API changes.
Adds deepcrawl scoping and JSON results on Search1API and AsyncSearch1API: start_deepcrawl() and deepcrawl() accept max_pages (1-1000), include_paths / exclude_paths (path rules: no * is a path prefix on segment boundaries, * matches any characters including /; exclusion wins) and format ("zip", the default, or "json"). DeepcrawlStatusResponse adds format, stats (discovered, matched, skipped, crawled, failed), failed ({url, error}), resultUrl and pages ({url, title, content}, Markdown; omitted above 5 MB). A task still costs 20 credits. The bundled OpenAPI snapshot also records X result metadata, failureCategory / upstreamStatus on errors, and 404/410 on POST /extract.
Adds maps(query, ...) on Search1API and AsyncSearch1API for POST /maps: one Google Maps page of up to 20 places with name, place ID and Maps link, plus address, phone, website, rating, review count, coordinates and opening hours when available. Keyword arguments: country, language, location (latitude, longitude, optional zoom), page (1-6, pages after the first need location) and max_results. 3 credits per completed page; API key or OAuth only. The bundled OpenAPI snapshot also records the 50-item batch limit for search, news and crawl.
Breaking response alignment: GitHub search and Hacker News news attributes are now under optional per-result metadata. Read result.metadata.stars, result.metadata.points, etc.; the old top-level attributes are removed. Common fields and optional published_date remain at the result top level.
Includes updated OpenAPI snapshot, result types, docs and nested-metadata regression coverage.
ask():对应 POST /ask,只接受 query(最多 500 字符),每次 5 credits。默认超时 45 秒,因为网关给 Ask 的上限是 35 秒feedback():对应 POST /feedback,免费。API 没有幂等键,所以默认不重试bingcn、yandex、grokipedia,删除 sogoupage,只有 bing、bingcn、baidu、grokipedia 支持分页published_date;github 结果新增 kind、stars、language、num_comments;hackernews 新闻新增 story_url、points、num_commentsOpenAPI 快照与线上 https://api.search1api.com/openapi.json 重新同步,类型定义已同步更新。
Full Changelog: v0.2.1...v0.3.0
客户端标识头之前还写着 python/0.2.0,现在是 python/0.3.0。