dataify-sdk 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,89 @@
1
+ """MCP protocol type definitions.
2
+
3
+ These map to the JSON-RPC 2.0 structures used by the Model Context Protocol.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from dataclasses import dataclass, field
9
+ from typing import Any
10
+
11
+
12
+ @dataclass
13
+ class JSONRPCRequest:
14
+ """A JSON-RPC 2.0 request."""
15
+
16
+ method: str
17
+ params: dict[str, Any] | None = None
18
+ jsonrpc: str = "2.0"
19
+ id: int = 0
20
+
21
+
22
+ @dataclass
23
+ class JSONRPCError:
24
+ """A JSON-RPC 2.0 error object."""
25
+
26
+ code: int
27
+ message: str
28
+ data: Any = None
29
+
30
+
31
+ @dataclass
32
+ class JSONRPCResponse:
33
+ """A JSON-RPC 2.0 response."""
34
+
35
+ id: int
36
+ jsonrpc: str = "2.0"
37
+ result: Any = None
38
+ error: JSONRPCError | None = None
39
+
40
+ @property
41
+ def is_error(self) -> bool:
42
+ """Check if this response contains an error."""
43
+ return self.error is not None
44
+
45
+
46
+ @dataclass
47
+ class ToolDefinition:
48
+ """An MCP tool definition as returned by tools/list."""
49
+
50
+ name: str
51
+ description: str = ""
52
+ inputSchema: dict[str, Any] = field(default_factory=dict)
53
+
54
+
55
+ @dataclass
56
+ class MCPServerCapabilities:
57
+ """Server capabilities reported during initialization."""
58
+
59
+ tools: dict[str, Any] | None = None
60
+ resources: dict[str, Any] | None = None
61
+ prompts: dict[str, Any] | None = None
62
+ logging: dict[str, Any] | None = None
63
+ experimental: dict[str, Any] | None = None
64
+
65
+
66
+ @dataclass
67
+ class ServerInfo:
68
+ """Server information returned by the initialize response."""
69
+
70
+ name: str
71
+ version: str
72
+ protocol_version: str = ""
73
+ capabilities: MCPServerCapabilities = field(default_factory=MCPServerCapabilities)
74
+ instructions: str | None = None
75
+
76
+
77
+ @dataclass
78
+ class CallToolResult:
79
+ """Structured result of a tools/call invocation.
80
+
81
+ When ``isError`` is True, the tool execution failed and ``content``
82
+ contains an error message. Otherwise ``content`` holds the
83
+ structured output and ``structured_content`` may carry a typed
84
+ payload the server attached.
85
+ """
86
+
87
+ content: Any
88
+ isError: bool = False
89
+ structured_content: Any = None
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: dataify-sdk
3
+ Version: 0.1.0
4
+ Summary: Python SDK for the Dataify MCP API — access web unlocker, search engines, and platform scrapers.
5
+ Project-URL: Homepage, https://dashboard.dataify.com
6
+ Project-URL: Repository, https://github.com/dataify/dataify-mcp-sdk
7
+ Author-email: Dataify <support@dataify.com>
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: dataify,google-search,mcp,scraper,serp,web-unlocker
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Internet :: WWW/HTTP
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: httpx>=0.28.0
23
+ Requires-Dist: pydantic>=2.0.0
24
+ Requires-Dist: typing-extensions>=4.0.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: jinja2>=3.0.0; extra == 'dev'
27
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
28
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
29
+ Requires-Dist: pytest-httpx>=0.30.0; extra == 'dev'
30
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
31
+ Requires-Dist: ruff>=0.6.0; extra == 'dev'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # Dataify MCP Python SDK
35
+
36
+ Python 客户端库,用于通过 [MCP (Model Context Protocol)](https://spec.modelcontextprotocol.io/) 访问 [Dataify](https://dashboard.dataify.com) 数据采集平台。
37
+
38
+ ## 功能
39
+
40
+ - 🌐 **网页解锁器** — 绕过 CAPTCHA、JS 渲染,返回 HTML 或 PNG 截图
41
+ - 🔍 **搜索引擎** — Google(17 种搜索类型)、Bing(6 种)、Yandex、DuckDuckGo
42
+ - 🛒 **平台抓取器** — Amazon、YouTube、TikTok、Facebook、Instagram、Reddit、Twitter/X、LinkedIn、Glassdoor、Indeed 等 35+ 平台
43
+ - ⚡ **异步优先** — 基于 `httpx` 的现代异步 API
44
+ - 🛡️ **类型安全** — 完整的类型注解,支持 `mypy --strict`
45
+ - 🔌 **双传输模式** — 支持 Streamable HTTP 和 SSE
46
+
47
+ ## 安装
48
+
49
+ ```bash
50
+ pip install dataify-mcp
51
+ ```
52
+
53
+ 要求 Python >= 3.10。
54
+
55
+ ## 快速开始
56
+
57
+ ```python
58
+ import asyncio
59
+ from dataify_mcp import DataifyClient
60
+
61
+ async def main():
62
+ async with DataifyClient(
63
+ base_url="http://localhost:7780",
64
+ token="your-api-token",
65
+ ) as client:
66
+ # 列出可用工具
67
+ tools = await client.list_tools()
68
+ print(f"可用工具: {len(tools)} 个")
69
+
70
+ # 调用 Google 搜索
71
+ result = await client.call_tool("google_search", {
72
+ "q": "今天天气",
73
+ "gl": "cn",
74
+ "hl": "zh-cn",
75
+ })
76
+ print(result)
77
+
78
+ asyncio.run(main())
79
+ ```
80
+
81
+ ## 连接方式
82
+
83
+ ### Streamable HTTP(默认)
84
+
85
+ ```python
86
+ client = DataifyClient(
87
+ base_url="http://localhost:7780",
88
+ token="your-token",
89
+ transport="http", # 默认值
90
+ )
91
+ ```
92
+
93
+ ### SSE(Server-Sent Events)
94
+
95
+ ```python
96
+ client = DataifyClient(
97
+ base_url="http://localhost:7780",
98
+ token="your-token",
99
+ transport="sse",
100
+ )
101
+ ```
102
+
103
+ ### 工具权限过滤
104
+
105
+ ```python
106
+ # 只使用指定的工具类别
107
+ client = DataifyClient(
108
+ base_url="http://localhost:7780",
109
+ token="your-token",
110
+ tool_codes="serp,google", # 多个用逗号分隔
111
+ )
112
+ ```
113
+
114
+ ## 错误处理
115
+
116
+ ```python
117
+ from dataify_mcp import (
118
+ DataifyClient,
119
+ AuthenticationError,
120
+ ToolError,
121
+ ConnectionError,
122
+ )
123
+
124
+ try:
125
+ async with DataifyClient("http://localhost:7780", "token") as client:
126
+ result = await client.call_tool("google_search", {"q": "test"})
127
+ except AuthenticationError:
128
+ print("Token 无效,请检查 https://dashboard.dataify.com")
129
+ except ToolError as e:
130
+ print(f"工具执行失败: {e}")
131
+ except ConnectionError:
132
+ print("无法连接服务器")
133
+ ```
134
+
135
+ ## 开发
136
+
137
+ ```bash
138
+ # 安装开发依赖
139
+ pip install -e ".[dev]"
140
+
141
+ # 代码检查
142
+ ruff check src/dataify_mcp/
143
+ mypy src/dataify_mcp/
144
+
145
+ # 运行测试
146
+ pytest
147
+
148
+ # 生成工具封装代码
149
+ python scripts/codegen.py --server http://localhost:7780 --token YOUR_TOKEN
150
+ ```
151
+
152
+ ## 许可
153
+
154
+ MIT License
@@ -0,0 +1,34 @@
1
+ dataify_mcp/__init__.py,sha256=3eXDv3uoyZPvPJWbyubt-z_81Qm6xjNTplB4tlZnDY0,934
2
+ dataify_mcp/_version.py,sha256=-UYTpK8lRuzcw9BEWkdBHyJiS_vjvg0P06Wo2xs--us,77
3
+ dataify_mcp/client/__init__.py,sha256=78M0JRVe0v3_SjXhzHo9vY0AVru9gp8TA5LpWtcLmIc,266
4
+ dataify_mcp/client/_base.py,sha256=UJBm89PDAjkPt-9SWoh3xnwNceF6Pi3fJgdk3zyfiP4,7376
5
+ dataify_mcp/client/_http.py,sha256=aWV-fX2fJXYpa_XIEg7nwqavs8sjb2K3osNC2vCEinI,6724
6
+ dataify_mcp/client/_protocol.py,sha256=_Iz6DIG9MismSCidBCEYjx9ZlvxFtUaQXY41A0AnzYU,7313
7
+ dataify_mcp/client/_sse.py,sha256=52Spk2bZgKqn0WbLc3cRg4NpyQx65tuZR4S4lTPnDG0,11608
8
+ dataify_mcp/tools/__init__.py,sha256=3bV0IQUbQuiu8pwhZnFlTBVWgfgEq4gJVc8XjAp1Oz0,2551
9
+ dataify_mcp/tools/amazon.py,sha256=lxqRAsAKuea9PWkWqwo5TUOinuzuFW9mXC3sfkw_-q4,6317
10
+ dataify_mcp/tools/bing.py,sha256=4xmSlSAZGH7PZL5u2jxhv7FpogKD0gmJHEWMVUvhCMs,5598
11
+ dataify_mcp/tools/facebook.py,sha256=TsuvAXTcHE88zi-abVr2HWLZ0EU27KzZS6vHvyn0uDA,2381
12
+ dataify_mcp/tools/glassdoor.py,sha256=mFRj6NOoyMtrNB0mtW30z9ctz-L-7yEr5ILCRFwVOAE,1493
13
+ dataify_mcp/tools/google_scraper.py,sha256=D9Y-s1E19G61MLtQfw-BNPcqc-8tpsPVAxv-O2k7G3g,5188
14
+ dataify_mcp/tools/google_serp.py,sha256=lnpL9oUXM_rXw3GTINFEb7q_IfMOwE_klG3u_YiWiCA,14205
15
+ dataify_mcp/tools/indeed.py,sha256=vzPJBtS17gTd7BoOIRQzHcqq7jA3lRdB-imA-06gTpo,1478
16
+ dataify_mcp/tools/instagram.py,sha256=NL_jRHKBv-urD73eantYGxlXYOnVyqqd2VHvDh4PyQw,1918
17
+ dataify_mcp/tools/linkedin.py,sha256=gbz56x3z0FjFzILTdpHoCqYdAHC3mmiqiRJ58uR0O_I,1674
18
+ dataify_mcp/tools/other_scrapers.py,sha256=kU3s66jZBYSEzyRUh9l4CLcNS_4kuf9BTknBEDBVyMU,5479
19
+ dataify_mcp/tools/other_search.py,sha256=mSw_dSu0JQm7Urj0Lgehl9lLSVvTIauSCOWyMyG0Fkk,3971
20
+ dataify_mcp/tools/reddit.py,sha256=GuZC_H08n_LqFwR5l8EpfXiQn8PTxB9Pnpm1mQ7Gba4,1356
21
+ dataify_mcp/tools/task_status.py,sha256=n-PgGAQA5ketTrES5kRj17xOgACBgB_F9BKCikDKV0E,7859
22
+ dataify_mcp/tools/tiktok.py,sha256=ftqq6p-XR1RHvB6llW3K_r71R4As4avgo9eMm9ieSwQ,3181
23
+ dataify_mcp/tools/twitter.py,sha256=7uv1zRr6adj3YvpREuBjiwrloAIvMzAEsgAKBRM5vg4,1385
24
+ dataify_mcp/tools/user.py,sha256=A4oQ3kLOEZcWydP8Oc9FHvrQjzqVr-YFn0GWOeTQIWQ,2644
25
+ dataify_mcp/tools/web_unlocker.py,sha256=Gj1YshmE7YmvLwzv7ymtQd5KyqyBnIYD4IWeqP63-lw,2573
26
+ dataify_mcp/tools/youtube.py,sha256=GZZNVMooeNnck4YKy9ErQcBY-xn1OKrm3WDaqUY4V0s,6832
27
+ dataify_mcp/types/__init__.py,sha256=OGKjtSU4Wa6sldFeZkOaGG-bkKcNWjusle07BHA5OuU,754
28
+ dataify_mcp/types/_enums.py,sha256=a5e1FE022nFOTDlsimoBt-pEEgGzrRPVRUaOmZ0le7c,4756
29
+ dataify_mcp/types/_errors.py,sha256=TGLQKAvd02OjsZoOhRjzadFZj8JY3w8XbIIwJ1MTV_s,2325
30
+ dataify_mcp/types/_mcp.py,sha256=XTftEL8BybdmOy9V3VogYuvm1me0-AmhBPK3-zSnuO0,2034
31
+ dataify_sdk-0.1.0.dist-info/METADATA,sha256=2QhYtXyQMsZIsHhoK2HuF9wQp5gB8x5FhKffc1tl2yQ,4148
32
+ dataify_sdk-0.1.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
33
+ dataify_sdk-0.1.0.dist-info/licenses/LICENSE,sha256=cil50Gh9EoDkZb-MQGFr1K8j82sbM5iHqCSxwkjmgag,1071
34
+ dataify_sdk-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.31.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dataify-server
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.