Skip to main content

Dataify Python SDK

Python 客户端库,直接调用 Dataify 上游 REST 接口(不走 MCP 协议),用于网页采集与搜索引擎抓取。

功能

  • 🔍 搜索引擎 — Google(17 种)、Bing(6 种)、Yandex、DuckDuckGo,走 POST /request
  • 🛒 平台抓取器 — Amazon、YouTube、TikTok、Facebook、Instagram、Reddit、Twitter/X、LinkedIn、Glassdoor、Indeed、Walmart、Zillow、Airbnb、Booking、Crunchbase、eBay、GitHub 等 45 个采集器,先走 POST /builder?platform=1,再可查询任务状态并下载结果
  • 📖 参数全暴露 — 每个工具函数把上游请求参数、类型、是否必填、中文描述都写在签名与 docstring 里;另见 docs/api_reference.md
  • 🐍 零依赖 — 仅用标准库 urllib,同步 API

安装

pip install dataify-sdk

要求 Python >= 3.10。

快速开始

from dataify_sdk import DataifyClient
from dataify_sdk.tools.amazonproduct import amazon_product_by_asin
from dataify_sdk.tools.googlesearch import google_search

# token 也可通过环境变量 DATAIFY_API_TOKEN 提供(兼容旧版 DATAIFY_TOKEN)
client = DataifyClient(token="YOUR_TOKEN")

# 采集类:先提交 Builder 任务
task = amazon_product_by_asin(asin="B0BZYCJK89", client=client)
task_id = task["data"]["task_id"]

# 再查询任务状态
status = client.query_scraper_task_status(task_id)
if status["data"]["status"] == "成功":
    result = client.download_scraper_task_result(task_id, result_type="json")

# 搜索类:直接打搜索引擎接口
result = google_search(q="pizza", client=client)

也可以不传 client,使用默认 client(优先读取 DATAIFY_API_TOKEN,兼容 DATAIFY_TOKEN):

export DATAIFY_API_TOKEN="..."
from dataify_sdk.tools.googlesearch import google_search

result = google_search(q="pizza")

client.query_scraper_task_status(...) 会返回任务状态 JSON,data.status 常见值为 处理中、成功、失败。任务成功后可用 client.download_scraper_task_result(task_id, result_type="json") 下载最终结果;result_type 支持 json、csv、xlsx。

API 设计

  • 每个 spider_id = 一个独立函数(采集类),例如 amazon_product_by_asin()、amazon_product_by_url()、amazon_product_by_keywords()。
  • 搜索类每个引擎一个函数,例如 google_search()、bing_search()、yandex_search()。
  • 所有函数签名与 docstring 完整暴露上游参数及其描述;docs/api_reference.md 为离线参数手册。
  • 函数返回解析后的 JSON dict(即上游原始响应)。

错误处理

from dataify_sdk import DataifyClient, DataifyAPIError, DataifyConnectionError

client = DataifyClient(token="YOUR_TOKEN")
try:
    result = google_search(q="pizza", client=client)
except DataifyAPIError as e:
    print(f"上游返回错误 HTTP {e.status_code}: {e.body}")
except DataifyConnectionError:
    print("无法连接 Dataify 上游")

开发

# 安装开发依赖
pip install -e ".[dev]"

# 运行测试
pytest

# 从 Go 参考项目重新生成工具函数与参数手册
python scripts/codegen.py

许可

MIT License

Metadata

Release files for dataify-sdk 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dataify-sdk 1.2.0
File Size Uploaded
dataify_sdk-1.2.0.tar.gz 56.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dataify-sdk 1.2.0
File Interpreter ABI Platform
dataify_sdk-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 189.0 kB

Release files / dataify_sdk-1.2.0.tar.gz

Download URL dataify_sdk-1.2.0.tar.gz
Size 56.2 kB
Tags Source
SHA-256 checksum
How to use checksums
012c2011a767346c6d0f54193f5cbe9766ab50e22e49b02192f2acbf6ab9c48e
BLAKE2b-256 checksum
How to use checksums
90a0f74c928a1862380c2fad9d7b30f7afb993fedcbd7a290c99bc9e1f817f67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / dataify_sdk-1.2.0-py3-none-any.whl

Download URL dataify_sdk-1.2.0-py3-none-any.whl
Size 132.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1851a749fbc3d7ac7df23bef7737b2fa18e9281c8ed6dbad5407baeedbe0b6c5
BLAKE2b-256 checksum
How to use checksums
fc197e38a532da5c872321bf27f35e7a6183cfce8d8187703cfdb1a1a072b8c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page