dataify-sdk 1.0.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/PKG-INFO +19 -7
  2. dataify_sdk-1.2.0/PYPI_RELEASE.md +154 -0
  3. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/README.md +30 -18
  4. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/pyproject.toml +1 -1
  5. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/scripts/codegen.py +3 -0
  6. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/__init__.py +16 -6
  7. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/_codegen/generate.py +8 -2
  8. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/client.py +196 -78
  9. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/errors.py +4 -0
  10. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/__init__.py +3 -0
  11. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/airbnbproduct.py +1 -1
  12. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/amazoncomment.py +1 -1
  13. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/amazonglobalproduct.py +4 -4
  14. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/amazonproduct.py +5 -5
  15. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/amazonproductlist.py +1 -1
  16. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/amazonseller.py +1 -1
  17. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/bingimages.py +1 -1
  18. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/bingmaps.py +1 -1
  19. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/bingnews.py +1 -1
  20. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/bingsearch.py +1 -1
  21. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/bingshopping.py +1 -1
  22. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/bingvideos.py +1 -1
  23. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/bookinghotellist.py +1 -1
  24. dataify_sdk-1.2.0/src/dataify_sdk/tools/chatgptanswer.py +66 -0
  25. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/crunchbasecompany.py +2 -2
  26. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/duckduckgosearch.py +1 -1
  27. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/ebayinfo.py +4 -4
  28. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/facebookcomment.py +1 -1
  29. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/facebookevent.py +2 -2
  30. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/facebookpost.py +1 -1
  31. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/facebookprofile.py +1 -1
  32. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/githubrepository.py +3 -3
  33. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/glassdoorcompany.py +4 -4
  34. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/glassdoorjoblistings.py +3 -3
  35. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googleaimode.py +1 -1
  36. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlefinance.py +1 -1
  37. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googleflights.py +1 -1
  38. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlehotels.py +1 -1
  39. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googleimages.py +1 -1
  40. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlejobs.py +1 -1
  41. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlelens.py +1 -1
  42. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlelocal.py +1 -1
  43. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlemapcomment.py +1 -1
  44. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlemapdetails.py +4 -4
  45. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlemaps.py +1 -1
  46. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlenews.py +1 -1
  47. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlepatents.py +1 -1
  48. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googleplay.py +1 -1
  49. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googleplaystoreinformation.py +1 -1
  50. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googleplaystorereviews.py +1 -1
  51. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlescholar.py +1 -1
  52. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlesearch.py +1 -1
  53. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googleshopping.py +1 -1
  54. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googleshoppinginfo.py +1 -1
  55. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googletrends.py +1 -1
  56. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/googlevideos.py +1 -1
  57. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/indeedcompaniesinfo.py +4 -4
  58. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/indeedjoblistings.py +1 -1
  59. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/instagramcomment.py +1 -1
  60. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/instagramprofiles.py +2 -2
  61. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/instagramreel.py +3 -3
  62. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/linkedincompanyinformation.py +1 -1
  63. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/linkedinjoblistingsinformation.py +3 -3
  64. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/redditcomment.py +1 -1
  65. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/redditposts.py +3 -3
  66. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/tiktokcomment.py +1 -1
  67. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/tiktokposts.py +1 -1
  68. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/tiktokprofiles.py +2 -2
  69. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/tiktokshop.py +1 -1
  70. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/twitterpost.py +1 -1
  71. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/twitterprofile.py +2 -2
  72. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/walmartproduct.py +4 -4
  73. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/yandexsearch.py +1 -1
  74. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/youtubeaudio.py +1 -1
  75. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/youtubecomment.py +1 -1
  76. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/youtubeproduct.py +1 -1
  77. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/youtubeprofiles.py +2 -2
  78. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/youtubetranscript.py +1 -1
  79. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/youtubevideo.py +1 -1
  80. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/youtubevideopost.py +6 -6
  81. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/tools/zillowproduct.py +1 -1
  82. dataify_sdk-1.2.0/tests/test_client/test_http_client.py +130 -0
  83. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/tests/test_tools/test_tool_modules.py +32 -4
  84. dataify_sdk-1.0.0/tests/test_client/test_http_client.py +0 -64
  85. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/.gitignore +0 -0
  86. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/LICENSE +0 -0
  87. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/src/dataify_sdk/_codegen/__init__.py +0 -0
  88. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/tests/__init__.py +0 -0
  89. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/tests/conftest.py +0 -0
  90. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/tests/test_client/__init__.py +0 -0
  91. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/tests/test_tools/__init__.py +0 -0
  92. {dataify_sdk-1.0.0 → dataify_sdk-1.2.0}/tests/test_tools/test_codegen.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: dataify-sdk
3
- Version: 1.0.0
3
+ Version: 1.2.0
4
4
  Summary: Python SDK that calls the Dataify upstream REST API directly (no MCP layer) — web scrapers and search engines.
5
5
  Project-URL: Homepage, https://dashboard.dataify.com
6
6
  Project-URL: Repository, https://github.com/dataify/dataify-sdk
@@ -31,7 +31,7 @@ Python 客户端库,**直接调用** [Dataify](https://dashboard.dataify.com)
31
31
  ## 功能
32
32
 
33
33
  - 🔍 **搜索引擎** — Google(17 种)、Bing(6 种)、Yandex、DuckDuckGo,走 `POST /request`
34
- - 🛒 **平台抓取器** — Amazon、YouTube、TikTok、Facebook、Instagram、Reddit、Twitter/X、LinkedIn、Glassdoor、Indeed、Walmart、Zillow、Airbnb、Booking、Crunchbase、eBay、GitHub 等 45 个采集器,走 `POST /builder?platform=1`
34
+ - 🛒 **平台抓取器** — Amazon、YouTube、TikTok、Facebook、Instagram、Reddit、Twitter/X、LinkedIn、Glassdoor、Indeed、Walmart、Zillow、Airbnb、Booking、Crunchbase、eBay、GitHub 等 45 个采集器,先走 `POST /builder?platform=1`,再可查询任务状态并下载结果
35
35
  - 📖 **参数全暴露** — 每个工具函数把上游请求参数、类型、是否必填、中文描述都写在签名与 docstring 里;另见 `docs/api_reference.md`
36
36
  - 🐍 **零依赖** — 仅用标准库 `urllib`,同步 API
37
37
 
@@ -50,17 +50,27 @@ from dataify_sdk import DataifyClient
50
50
  from dataify_sdk.tools.amazonproduct import amazon_product_by_asin
51
51
  from dataify_sdk.tools.googlesearch import google_search
52
52
 
53
- # token 也可通过环境变量 DATAIFY_TOKEN 提供
53
+ # token 也可通过环境变量 DATAIFY_API_TOKEN 提供(兼容旧版 DATAIFY_TOKEN)
54
54
  client = DataifyClient(token="YOUR_TOKEN")
55
55
 
56
- # 采集类:直接提交 Builder 任务
57
- result = amazon_product_by_asin(asin="B0BZYCJK89", client=client)
56
+ # 采集类:先提交 Builder 任务
57
+ task = amazon_product_by_asin(asin="B0BZYCJK89", client=client)
58
+ task_id = task["data"]["task_id"]
59
+
60
+ # 再查询任务状态
61
+ status = client.query_scraper_task_status(task_id)
62
+ if status["data"]["status"] == "成功":
63
+ result = client.download_scraper_task_result(task_id, result_type="json")
58
64
 
59
65
  # 搜索类:直接打搜索引擎接口
60
66
  result = google_search(q="pizza", client=client)
61
67
  ```
62
68
 
63
- 也可以不传 `client`,使用默认 client(读取 `DATAIFY_TOKEN` 环境变量):
69
+ 也可以不传 `client`,使用默认 client(优先读取 `DATAIFY_API_TOKEN`,兼容 `DATAIFY_TOKEN`):
70
+
71
+ ```bash
72
+ export DATAIFY_API_TOKEN="..."
73
+ ```
64
74
 
65
75
  ```python
66
76
  from dataify_sdk.tools.googlesearch import google_search
@@ -68,6 +78,8 @@ from dataify_sdk.tools.googlesearch import google_search
68
78
  result = google_search(q="pizza")
69
79
  ```
70
80
 
81
+ `client.query_scraper_task_status(...)` 会返回任务状态 JSON,`data.status` 常见值为 `处理中`、`成功`、`失败`。任务成功后可用 `client.download_scraper_task_result(task_id, result_type="json")` 下载最终结果;`result_type` 支持 `json`、`csv`、`xlsx`。
82
+
71
83
  ## API 设计
72
84
 
73
85
  - **每个 `spider_id` = 一个独立函数**(采集类),例如 `amazon_product_by_asin()`、`amazon_product_by_url()`、`amazon_product_by_keywords()`。
@@ -0,0 +1,154 @@
1
+ # Dataify Python SDK 更新发布步骤
2
+
3
+ 适用于把当前 `dataify-sdk` 新版本发布到 PyPI。
4
+
5
+ ## 1. 更新版本号
6
+
7
+ 修改两个位置,版本号必须一致:
8
+
9
+ ```text
10
+ pyproject.toml
11
+ src/dataify_sdk/__init__.py
12
+ ```
13
+
14
+ 例如本次新增公开方法,建议改为:
15
+
16
+ ```text
17
+ 1.1.0
18
+ ```
19
+
20
+ ## 2. 检查代码状态
21
+
22
+ ```powershell
23
+ git status --short
24
+ ```
25
+
26
+ 确认只包含本次要发布的改动。
27
+
28
+ ## 3. 安装开发依赖
29
+
30
+ ```powershell
31
+ python -m pip install -e ".[dev]"
32
+ ```
33
+
34
+ ## 4. 运行测试
35
+
36
+ ```powershell
37
+ python -m pytest
38
+ python -m compileall src tests
39
+ ```
40
+
41
+ 测试通过后再继续。
42
+
43
+ ## 5. 安装发布工具
44
+
45
+ ```powershell
46
+ python -m pip install --upgrade build twine
47
+ ```
48
+
49
+ ## 6. 清理旧构建产物
50
+
51
+ ```powershell
52
+ Remove-Item -LiteralPath .\dist -Recurse -Force -ErrorAction SilentlyContinue
53
+ Remove-Item -LiteralPath .\build -Recurse -Force -ErrorAction SilentlyContinue
54
+ ```
55
+
56
+ ## 7. 构建新版本
57
+
58
+ ```powershell
59
+ python -m build
60
+ ```
61
+
62
+ 构建后检查 `dist/` 下是否生成:
63
+
64
+ ```text
65
+ *.tar.gz
66
+ *.whl
67
+ ```
68
+
69
+ ## 8. 检查发布包
70
+
71
+ ```powershell
72
+ python -m twine check --strict dist/*
73
+ ```
74
+
75
+ 必须通过。
76
+
77
+ ## 9. 先发到 TestPyPI
78
+
79
+ ```powershell
80
+ python -m twine upload --repository testpypi dist/*
81
+ ```
82
+
83
+ 登录时:
84
+
85
+ ```text
86
+ username: __token__
87
+ password: TestPyPI token
88
+ ```
89
+
90
+ 如果看到 `WARNING This environment is not supported for trusted publishing`,本机发布时可以忽略,继续用上面的 token 登录即可。
91
+
92
+ 如果返回 `403 Forbidden`,先执行:
93
+
94
+ ```powershell
95
+ python -m twine upload --repository testpypi --verbose dist/*
96
+ ```
97
+
98
+ 常见原因:
99
+
100
+ - 用了正式 PyPI token;TestPyPI 必须用 TestPyPI 单独创建的 token。
101
+ - token 对应账号不是 `dataify-sdk` 在 TestPyPI 上的 owner/maintainer。
102
+ - 项目级 token 只能上传已有项目;首次创建项目建议用 TestPyPI 账号级 token。
103
+ - TestPyPI 账号邮箱未验证。
104
+ - 版本号或文件已上传过,换一个新版本号后重新构建。
105
+
106
+ ## 10. 从 TestPyPI 安装验证
107
+
108
+ ```powershell
109
+ python -m venv .venv-testpypi-check
110
+ .\.venv-testpypi-check\Scripts\python -m pip install --upgrade pip
111
+ .\.venv-testpypi-check\Scripts\python -m pip install --index-url https://test.pypi.org/simple/ --no-deps dataify-sdk==<版本号>
112
+ .\.venv-testpypi-check\Scripts\python -c "import dataify_sdk; print(dataify_sdk.__version__)"
113
+ ```
114
+
115
+ 确认输出版本号正确。
116
+
117
+ ## 11. 发布到正式 PyPI
118
+
119
+ ```powershell
120
+ python -m twine upload dist/*
121
+ ```
122
+
123
+ 登录时:
124
+
125
+ ```text
126
+ username: __token__
127
+ password: PyPI token
128
+ ```
129
+
130
+ 如果看到 `WARNING This environment is not supported for trusted publishing`,本机发布时可以忽略,继续用上面的 token 登录即可。
131
+
132
+ ## 12. 从正式 PyPI 安装验证
133
+
134
+ ```powershell
135
+ python -m venv .venv-pypi-check
136
+ .\.venv-pypi-check\Scripts\python -m pip install --upgrade pip
137
+ .\.venv-pypi-check\Scripts\python -m pip install --no-cache-dir dataify-sdk==<版本号>
138
+ .\.venv-pypi-check\Scripts\python -c "import dataify_sdk; print(dataify_sdk.__version__)"
139
+ ```
140
+
141
+ 确认输出版本号正确。
142
+
143
+ ## 13. 打 Git Tag
144
+
145
+ ```powershell
146
+ git tag v<版本号>
147
+ git push origin v<版本号>
148
+ ```
149
+
150
+ ## 注意
151
+
152
+ - PyPI 已发布的同版本不能覆盖上传。
153
+ - token 不要写进代码、README 或提交记录。
154
+ - 如果发布后发现问题,直接修复后发下一个版本。
@@ -6,7 +6,7 @@ Python 客户端库,**直接调用** [Dataify](https://dashboard.dataify.com)
6
6
  ## 功能
7
7
 
8
8
  - 🔍 **搜索引擎** — Google(17 种)、Bing(6 种)、Yandex、DuckDuckGo,走 `POST /request`
9
- - 🛒 **平台抓取器** — Amazon、YouTube、TikTok、Facebook、Instagram、Reddit、Twitter/X、LinkedIn、Glassdoor、Indeed、Walmart、Zillow、Airbnb、Booking、Crunchbase、eBay、GitHub 等 45 个采集器,走 `POST /builder?platform=1`
9
+ - 🛒 **平台抓取器** — Amazon、YouTube、TikTok、Facebook、Instagram、Reddit、Twitter/X、LinkedIn、Glassdoor、Indeed、Walmart、Zillow、Airbnb、Booking、Crunchbase、eBay、GitHub 等 45 个采集器,先走 `POST /builder?platform=1`,再可查询任务状态并下载结果
10
10
  - 📖 **参数全暴露** — 每个工具函数把上游请求参数、类型、是否必填、中文描述都写在签名与 docstring 里;另见 `docs/api_reference.md`
11
11
  - 🐍 **零依赖** — 仅用标准库 `urllib`,同步 API
12
12
 
@@ -25,23 +25,35 @@ from dataify_sdk import DataifyClient
25
25
  from dataify_sdk.tools.amazonproduct import amazon_product_by_asin
26
26
  from dataify_sdk.tools.googlesearch import google_search
27
27
 
28
- # token 也可通过环境变量 DATAIFY_TOKEN 提供
29
- client = DataifyClient(token="YOUR_TOKEN")
30
-
31
- # 采集类:直接提交 Builder 任务
32
- result = amazon_product_by_asin(asin="B0BZYCJK89", client=client)
33
-
34
- # 搜索类:直接打搜索引擎接口
35
- result = google_search(q="pizza", client=client)
36
- ```
37
-
38
- 也可以不传 `client`,使用默认 client(读取 `DATAIFY_TOKEN` 环境变量):
39
-
40
- ```python
41
- from dataify_sdk.tools.googlesearch import google_search
42
-
43
- result = google_search(q="pizza")
44
- ```
28
+ # token 也可通过环境变量 DATAIFY_API_TOKEN 提供(兼容旧版 DATAIFY_TOKEN)
29
+ client = DataifyClient(token="YOUR_TOKEN")
30
+
31
+ # 采集类:先提交 Builder 任务
32
+ task = amazon_product_by_asin(asin="B0BZYCJK89", client=client)
33
+ task_id = task["data"]["task_id"]
34
+
35
+ # 再查询任务状态
36
+ status = client.query_scraper_task_status(task_id)
37
+ if status["data"]["status"] == "成功":
38
+ result = client.download_scraper_task_result(task_id, result_type="json")
39
+
40
+ # 搜索类:直接打搜索引擎接口
41
+ result = google_search(q="pizza", client=client)
42
+ ```
43
+
44
+ 也可以不传 `client`,使用默认 client(优先读取 `DATAIFY_API_TOKEN`,兼容 `DATAIFY_TOKEN`):
45
+
46
+ ```bash
47
+ export DATAIFY_API_TOKEN="..."
48
+ ```
49
+
50
+ ```python
51
+ from dataify_sdk.tools.googlesearch import google_search
52
+
53
+ result = google_search(q="pizza")
54
+ ```
55
+
56
+ `client.query_scraper_task_status(...)` 会返回任务状态 JSON,`data.status` 常见值为 `处理中`、`成功`、`失败`。任务成功后可用 `client.download_scraper_task_result(task_id, result_type="json")` 下载最终结果;`result_type` 支持 `json`、`csv`、`xlsx`。
45
57
 
46
58
  ## API 设计
47
59
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "dataify-sdk"
7
- version = "1.0.0"
7
+ version = "1.2.0"
8
8
  description = "Python SDK that calls the Dataify upstream REST API directly (no MCP layer) — web scrapers and search engines."
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -21,5 +21,8 @@ sys.path.insert(0, str(_ROOT / "src"))
21
21
  from dataify_sdk._codegen.generate import main
22
22
 
23
23
 
24
+
25
+
26
+
24
27
  if __name__ == "__main__":
25
28
  raise SystemExit(main())
@@ -7,11 +7,18 @@ Typical usage::
7
7
  from dataify_sdk.tools.amazonproduct import amazon_product_by_asin
8
8
 
9
9
  client = DataifyClient(token="YOUR_TOKEN")
10
- result = amazon_product_by_asin(asin="B0BZYCJK89", client=client)
11
-
12
- or, using the default client (token from ``DATAIFY_TOKEN``)::
13
-
14
- result = amazon_product_by_asin(asin="B0BZYCJK89")
10
+ task = amazon_product_by_asin(asin="B0BZYCJK89", client=client)
11
+ task_id = task["data"]["task_id"]
12
+ status = client.query_scraper_task_status(task_id)
13
+ if status["data"]["status"] == "成功":
14
+ result = client.download_scraper_task_result(task_id, result_type="json")
15
+
16
+ or, using the default client (token from ``DATAIFY_API_TOKEN``, with
17
+ ``DATAIFY_TOKEN`` still accepted)::
18
+
19
+ task = amazon_product_by_asin(asin="B0BZYCJK89")
20
+ client = DataifyClient()
21
+ status = client.query_scraper_task_status(task["data"]["task_id"])
15
22
  """
16
23
 
17
24
  from __future__ import annotations
@@ -24,7 +31,10 @@ from dataify_sdk.errors import (
24
31
  DataifyTimeoutError,
25
32
  )
26
33
 
27
- __version__ = "1.0.0"
34
+ __version__ = "1.2.0"
35
+
36
+
37
+
28
38
 
29
39
  __all__ = [
30
40
  "__version__",
@@ -434,7 +434,10 @@ def render_scraper_function(
434
434
  ]
435
435
  for p in sig_params:
436
436
  doc.append(_doc_param_line(p, p["upstream"]))
437
- doc.append(" client: 可选 DataifyClient 实例;不传则使用默认 client(读取 DATAIFY_TOKEN)。")
437
+ doc.append(
438
+ " client: 可选 DataifyClient 实例;不传则使用默认 client("
439
+ "优先读取 DATAIFY_API_TOKEN, 兼容 DATAIFY_TOKEN)。"
440
+ )
438
441
  doc.append(' """')
439
442
  doc.append(" params_obj = {")
440
443
  doc.extend(body_assign)
@@ -492,7 +495,10 @@ def render_serp_function(
492
495
  ]
493
496
  for p in sig_params:
494
497
  doc.append(_doc_param_line(p, p["upstream"]))
495
- doc.append(" client: 可选 DataifyClient 实例;不传则使用默认 client(读取 DATAIFY_TOKEN)。")
498
+ doc.append(
499
+ " client: 可选 DataifyClient 实例;不传则使用默认 client("
500
+ "优先读取 DATAIFY_API_TOKEN, 兼容 DATAIFY_TOKEN)。"
501
+ )
496
502
  doc.append(' """')
497
503
  doc.append(" form = {")
498
504
  doc.extend(body_assign)