js-captcha 1.0.0__tar.gz → 2.0.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.
- {js_captcha-1.0.0/src/js_captcha.egg-info → js_captcha-2.0.0}/PKG-INFO +30 -4
- {js_captcha-1.0.0 → js_captcha-2.0.0}/README.md +29 -3
- {js_captcha-1.0.0 → js_captcha-2.0.0}/examples/products.py +0 -1
- {js_captcha-1.0.0 → js_captcha-2.0.0}/pyproject.toml +1 -1
- {js_captcha-1.0.0 → js_captcha-2.0.0}/src/js_captcha/_protocol.py +1 -1
- js_captcha-2.0.0/src/js_captcha/_version.py +1 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/src/js_captcha/client.py +0 -14
- {js_captcha-1.0.0 → js_captcha-2.0.0/src/js_captcha.egg-info}/PKG-INFO +30 -4
- js_captcha-1.0.0/src/js_captcha/_version.py +0 -1
- {js_captcha-1.0.0 → js_captcha-2.0.0}/LICENSE +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/MANIFEST.in +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/NOTICE +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/examples/solve.py +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/setup.cfg +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/src/js_captcha/__init__.py +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/src/js_captcha/cloudflare.py +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/src/js_captcha/errors.py +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/src/js_captcha/models.py +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/src/js_captcha/py.typed +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/src/js_captcha.egg-info/SOURCES.txt +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/src/js_captcha.egg-info/dependency_links.txt +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/src/js_captcha.egg-info/requires.txt +0 -0
- {js_captcha-1.0.0 → js_captcha-2.0.0}/src/js_captcha.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: js-captcha
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: Official Python SDK for the Js-Captcha API with blocking and async clients
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Homepage, https://www.js-captcha.com
|
|
@@ -21,7 +21,7 @@ Dynamic: license-file
|
|
|
21
21
|
Python ≥3.11,依赖 `wreq>=0.12.2,<0.13`,包含同步 `JsCaptchaSolver` 与异步 `AsyncJsCaptchaSolver`,通过公开 HTTPS API 调用服务。
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
|
-
python -m pip install js-captcha==
|
|
24
|
+
python -m pip install js-captcha==2.0.0
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
```python
|
|
@@ -71,7 +71,7 @@ asyncio.run(main())
|
|
|
71
71
|
|
|
72
72
|
源码包内的 `examples/solve.py` 和 `examples/products.py` 提供命令行调用示例。API Key 和目标参数均由调用方提供。
|
|
73
73
|
|
|
74
|
-
默认网关 `https://api.js-captcha.com`;`base_url` 可显式覆盖,常量 `DEFAULT_BASE_URL` 可导入。同步与异步客户端均有下列
|
|
74
|
+
默认网关 `https://api.js-captcha.com`;`base_url` 可显式覆盖,常量 `DEFAULT_BASE_URL` 可导入。同步与异步客户端均有下列 8 个专用方法。例如 `solver.cloudflare_challenge(payload, timeout_ms=120000, request_id=rid)`,异步客户端使用 `await`,每个方法均返回完整 `SolveResponse`。
|
|
75
75
|
|
|
76
76
|
可运行入口(在本目录执行,先按真实目标准备 `payload.json` 并通过环境变量注入 AK):
|
|
77
77
|
|
|
@@ -92,10 +92,36 @@ python3 examples/products.py cloudflare_challenge payload.json --async
|
|
|
92
92
|
| `incapsula_execute` | `incapsula/execute` |
|
|
93
93
|
| `kasada_tl` | `kasada/tl` |
|
|
94
94
|
| `kasada_cd` | `kasada/cd` |
|
|
95
|
-
| `kasada_payload` | `kasada/payload` |
|
|
96
95
|
|
|
97
96
|
产品方法接受参数字典;可用 Action、参数要求和账户权限以服务端公开 API 文档为准。
|
|
98
97
|
|
|
98
|
+
## 从 1.0.0 升级
|
|
99
|
+
|
|
100
|
+
2.0.0 移除了 `kasada_payload`(同步与异步客户端)。Kasada 请改用 `kasada_tl`:
|
|
101
|
+
服务端经调用方提供的代理发送 TL,并返回结果。其余方法和参数不变。
|
|
102
|
+
|
|
103
|
+
## Kasada
|
|
104
|
+
|
|
105
|
+
`kasada_tl` 的参数始终包含目标页面 `url` 和代理 `proxy`(需保持同一出口 IP 的粘性会话):
|
|
106
|
+
|
|
107
|
+
- 只传 `url`、`proxy`:由服务端获取挑战并完成 TL。TL 接口与页面不同源时加 `tl_host`
|
|
108
|
+
(如 `https://gql.example.com`);可选 `fp_url` 指定挑战页面地址。
|
|
109
|
+
- 已自行取得挑战脚本时,同时传 `ips`(完整脚本)、`ips_url`(脚本的实际来源地址)和
|
|
110
|
+
`user_agent`(获取脚本时的 UA),此时不能再传 `fp_url`。
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
response = solver.kasada_tl({"url": os.environ["TARGET_URL"], "proxy": os.environ["TARGET_PROXY"]},
|
|
114
|
+
timeout_ms=120000)
|
|
115
|
+
result = response.result
|
|
116
|
+
# {"body": "...",
|
|
117
|
+
# "request_headers": {"user-agent": "...", "accept-language": "..."},
|
|
118
|
+
# "response_headers": [{"name": "x-kpsdk-ct", "value": "..."}, ...]}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
后续访问目标站点时,使用 `request_headers` 中的 User-Agent 和语言,并沿用同一代理。
|
|
122
|
+
`response_headers` 按原样保留重复项(包括 `set-cookie`)。SDK 只转发结果,不管理目标站点的会话。
|
|
123
|
+
`kasada_cd` 使用 `ct`、`st`(整数)和 `host`。
|
|
124
|
+
|
|
99
125
|
## Cloudflare HTML
|
|
100
126
|
|
|
101
127
|
`cloudflare_challenge` 和 `cloudflare_challenge_fast` 会自动精简传入的 HTML,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Python ≥3.11,依赖 `wreq>=0.12.2,<0.13`,包含同步 `JsCaptchaSolver` 与异步 `AsyncJsCaptchaSolver`,通过公开 HTTPS API 调用服务。
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
python -m pip install js-captcha==
|
|
6
|
+
python -m pip install js-captcha==2.0.0
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
```python
|
|
@@ -53,7 +53,7 @@ asyncio.run(main())
|
|
|
53
53
|
|
|
54
54
|
源码包内的 `examples/solve.py` 和 `examples/products.py` 提供命令行调用示例。API Key 和目标参数均由调用方提供。
|
|
55
55
|
|
|
56
|
-
默认网关 `https://api.js-captcha.com`;`base_url` 可显式覆盖,常量 `DEFAULT_BASE_URL` 可导入。同步与异步客户端均有下列
|
|
56
|
+
默认网关 `https://api.js-captcha.com`;`base_url` 可显式覆盖,常量 `DEFAULT_BASE_URL` 可导入。同步与异步客户端均有下列 8 个专用方法。例如 `solver.cloudflare_challenge(payload, timeout_ms=120000, request_id=rid)`,异步客户端使用 `await`,每个方法均返回完整 `SolveResponse`。
|
|
57
57
|
|
|
58
58
|
可运行入口(在本目录执行,先按真实目标准备 `payload.json` 并通过环境变量注入 AK):
|
|
59
59
|
|
|
@@ -74,10 +74,36 @@ python3 examples/products.py cloudflare_challenge payload.json --async
|
|
|
74
74
|
| `incapsula_execute` | `incapsula/execute` |
|
|
75
75
|
| `kasada_tl` | `kasada/tl` |
|
|
76
76
|
| `kasada_cd` | `kasada/cd` |
|
|
77
|
-
| `kasada_payload` | `kasada/payload` |
|
|
78
77
|
|
|
79
78
|
产品方法接受参数字典;可用 Action、参数要求和账户权限以服务端公开 API 文档为准。
|
|
80
79
|
|
|
80
|
+
## 从 1.0.0 升级
|
|
81
|
+
|
|
82
|
+
2.0.0 移除了 `kasada_payload`(同步与异步客户端)。Kasada 请改用 `kasada_tl`:
|
|
83
|
+
服务端经调用方提供的代理发送 TL,并返回结果。其余方法和参数不变。
|
|
84
|
+
|
|
85
|
+
## Kasada
|
|
86
|
+
|
|
87
|
+
`kasada_tl` 的参数始终包含目标页面 `url` 和代理 `proxy`(需保持同一出口 IP 的粘性会话):
|
|
88
|
+
|
|
89
|
+
- 只传 `url`、`proxy`:由服务端获取挑战并完成 TL。TL 接口与页面不同源时加 `tl_host`
|
|
90
|
+
(如 `https://gql.example.com`);可选 `fp_url` 指定挑战页面地址。
|
|
91
|
+
- 已自行取得挑战脚本时,同时传 `ips`(完整脚本)、`ips_url`(脚本的实际来源地址)和
|
|
92
|
+
`user_agent`(获取脚本时的 UA),此时不能再传 `fp_url`。
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
response = solver.kasada_tl({"url": os.environ["TARGET_URL"], "proxy": os.environ["TARGET_PROXY"]},
|
|
96
|
+
timeout_ms=120000)
|
|
97
|
+
result = response.result
|
|
98
|
+
# {"body": "...",
|
|
99
|
+
# "request_headers": {"user-agent": "...", "accept-language": "..."},
|
|
100
|
+
# "response_headers": [{"name": "x-kpsdk-ct", "value": "..."}, ...]}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
后续访问目标站点时,使用 `request_headers` 中的 User-Agent 和语言,并沿用同一代理。
|
|
104
|
+
`response_headers` 按原样保留重复项(包括 `set-cookie`)。SDK 只转发结果,不管理目标站点的会话。
|
|
105
|
+
`kasada_cd` 使用 `ct`、`st`(整数)和 `host`。
|
|
106
|
+
|
|
81
107
|
## Cloudflare HTML
|
|
82
108
|
|
|
83
109
|
`cloudflare_challenge` 和 `cloudflare_challenge_fast` 会自动精简传入的 HTML,
|
|
@@ -57,7 +57,7 @@ def route(product: str, action: str) -> str:
|
|
|
57
57
|
if not isinstance(product, str) or not _IDENTIFIER.fullmatch(product) or not isinstance(action, str) or not _ACTION.fullmatch(action):
|
|
58
58
|
raise ValidationError("product/action must be 1–64 letters, digits, underscores or hyphens; actions also allow colons")
|
|
59
59
|
if product not in ("cloudflare", "kasada", "incapsula"):
|
|
60
|
-
raise ValidationError("
|
|
60
|
+
raise ValidationError("js-captcha supports cloudflare, kasada and incapsula")
|
|
61
61
|
return f"v1/{product}/{action}"
|
|
62
62
|
|
|
63
63
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.0.0"
|
|
@@ -160,13 +160,6 @@ class JsCaptchaSolver(_Configuration):
|
|
|
160
160
|
return self.solve("kasada", "cd", payload,
|
|
161
161
|
timeout_ms=timeout_ms, request_id=request_id)
|
|
162
162
|
|
|
163
|
-
def kasada_payload(self, payload: Mapping[str, Any], *,
|
|
164
|
-
timeout_ms: int | None = None,
|
|
165
|
-
request_id: str | UUID | None = None) -> SolveResponse:
|
|
166
|
-
"""Submit kasada/payload; payload follows the product schema."""
|
|
167
|
-
return self.solve("kasada", "payload", payload,
|
|
168
|
-
timeout_ms=timeout_ms, request_id=request_id)
|
|
169
|
-
|
|
170
163
|
|
|
171
164
|
|
|
172
165
|
|
|
@@ -302,13 +295,6 @@ class AsyncJsCaptchaSolver(_Configuration):
|
|
|
302
295
|
return await self.solve("kasada", "cd", payload,
|
|
303
296
|
timeout_ms=timeout_ms, request_id=request_id)
|
|
304
297
|
|
|
305
|
-
async def kasada_payload(self, payload: Mapping[str, Any], *,
|
|
306
|
-
timeout_ms: int | None = None,
|
|
307
|
-
request_id: str | UUID | None = None) -> SolveResponse:
|
|
308
|
-
"""Submit kasada/payload; payload follows the product schema."""
|
|
309
|
-
return await self.solve("kasada", "payload", payload,
|
|
310
|
-
timeout_ms=timeout_ms, request_id=request_id)
|
|
311
|
-
|
|
312
298
|
|
|
313
299
|
|
|
314
300
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: js-captcha
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: Official Python SDK for the Js-Captcha API with blocking and async clients
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Homepage, https://www.js-captcha.com
|
|
@@ -21,7 +21,7 @@ Dynamic: license-file
|
|
|
21
21
|
Python ≥3.11,依赖 `wreq>=0.12.2,<0.13`,包含同步 `JsCaptchaSolver` 与异步 `AsyncJsCaptchaSolver`,通过公开 HTTPS API 调用服务。
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
|
-
python -m pip install js-captcha==
|
|
24
|
+
python -m pip install js-captcha==2.0.0
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
```python
|
|
@@ -71,7 +71,7 @@ asyncio.run(main())
|
|
|
71
71
|
|
|
72
72
|
源码包内的 `examples/solve.py` 和 `examples/products.py` 提供命令行调用示例。API Key 和目标参数均由调用方提供。
|
|
73
73
|
|
|
74
|
-
默认网关 `https://api.js-captcha.com`;`base_url` 可显式覆盖,常量 `DEFAULT_BASE_URL` 可导入。同步与异步客户端均有下列
|
|
74
|
+
默认网关 `https://api.js-captcha.com`;`base_url` 可显式覆盖,常量 `DEFAULT_BASE_URL` 可导入。同步与异步客户端均有下列 8 个专用方法。例如 `solver.cloudflare_challenge(payload, timeout_ms=120000, request_id=rid)`,异步客户端使用 `await`,每个方法均返回完整 `SolveResponse`。
|
|
75
75
|
|
|
76
76
|
可运行入口(在本目录执行,先按真实目标准备 `payload.json` 并通过环境变量注入 AK):
|
|
77
77
|
|
|
@@ -92,10 +92,36 @@ python3 examples/products.py cloudflare_challenge payload.json --async
|
|
|
92
92
|
| `incapsula_execute` | `incapsula/execute` |
|
|
93
93
|
| `kasada_tl` | `kasada/tl` |
|
|
94
94
|
| `kasada_cd` | `kasada/cd` |
|
|
95
|
-
| `kasada_payload` | `kasada/payload` |
|
|
96
95
|
|
|
97
96
|
产品方法接受参数字典;可用 Action、参数要求和账户权限以服务端公开 API 文档为准。
|
|
98
97
|
|
|
98
|
+
## 从 1.0.0 升级
|
|
99
|
+
|
|
100
|
+
2.0.0 移除了 `kasada_payload`(同步与异步客户端)。Kasada 请改用 `kasada_tl`:
|
|
101
|
+
服务端经调用方提供的代理发送 TL,并返回结果。其余方法和参数不变。
|
|
102
|
+
|
|
103
|
+
## Kasada
|
|
104
|
+
|
|
105
|
+
`kasada_tl` 的参数始终包含目标页面 `url` 和代理 `proxy`(需保持同一出口 IP 的粘性会话):
|
|
106
|
+
|
|
107
|
+
- 只传 `url`、`proxy`:由服务端获取挑战并完成 TL。TL 接口与页面不同源时加 `tl_host`
|
|
108
|
+
(如 `https://gql.example.com`);可选 `fp_url` 指定挑战页面地址。
|
|
109
|
+
- 已自行取得挑战脚本时,同时传 `ips`(完整脚本)、`ips_url`(脚本的实际来源地址)和
|
|
110
|
+
`user_agent`(获取脚本时的 UA),此时不能再传 `fp_url`。
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
response = solver.kasada_tl({"url": os.environ["TARGET_URL"], "proxy": os.environ["TARGET_PROXY"]},
|
|
114
|
+
timeout_ms=120000)
|
|
115
|
+
result = response.result
|
|
116
|
+
# {"body": "...",
|
|
117
|
+
# "request_headers": {"user-agent": "...", "accept-language": "..."},
|
|
118
|
+
# "response_headers": [{"name": "x-kpsdk-ct", "value": "..."}, ...]}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
后续访问目标站点时,使用 `request_headers` 中的 User-Agent 和语言,并沿用同一代理。
|
|
122
|
+
`response_headers` 按原样保留重复项(包括 `set-cookie`)。SDK 只转发结果,不管理目标站点的会话。
|
|
123
|
+
`kasada_cd` 使用 `ct`、`st`(整数)和 `host`。
|
|
124
|
+
|
|
99
125
|
## Cloudflare HTML
|
|
100
126
|
|
|
101
127
|
`cloudflare_challenge` 和 `cloudflare_challenge_fast` 会自动精简传入的 HTML,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.0.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|