Skip to content

Commit 294ce58

Browse files
committed
fix: status mismatch (success/completed) and resultUrl field mapping
1 parent 847c7c8 commit 294ce58

8 files changed

Lines changed: 24 additions & 5 deletions

File tree

bypasstools.egg-info/PKG-INFO

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Metadata-Version: 2.2
2+
Name: bypasstools
3+
Version: 1.0.0
4+
Summary: Official Python SDK for the BypassTools API
5+
License: MIT
6+
Project-URL: Homepage, https://bypass.tools
7+
Project-URL: Repository, https://github.com/XxEASTRxX/bypasstools-sdks-python.git
8+
Keywords: bypasstools,bypass,linkvertise,api
9+
Requires-Python: >=3.8
10+
Description-Content-Type: text/markdown

bypasstools.egg-info/SOURCES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pyproject.toml
2+
bypasstools/__init__.py
3+
bypasstools/client.py
4+
bypasstools.egg-info/PKG-INFO
5+
bypasstools.egg-info/SOURCES.txt
6+
bypasstools.egg-info/dependency_links.txt
7+
bypasstools.egg-info/top_level.txt
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

bypasstools.egg-info/top_level.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bypasstools

bypasstools/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def bypass(self, url: str, *, refresh: bool = False) -> BypassResult:
111111
raise BypassToolsError("url is required", "MISSING_URL")
112112
data = self._request("POST", "/bypass/direct", {"url": url, "refresh": refresh})
113113
return BypassResult(
114-
result_url = data.get("result", ""),
114+
result_url = data.get("resultUrl") or data.get("result", ""),
115115
cached = data.get("cached", False),
116116
process_time = data.get("processTime"),
117117
request_id = data.get("requestId"),
@@ -165,7 +165,7 @@ def bypass_async(
165165
while time.monotonic() < deadline:
166166
time.sleep(poll_interval)
167167
result = self.get_task_result(task_id)
168-
if result.status == "completed":
168+
if result.status in ("completed", "success"):
169169
return BypassResult(
170170
result_url = result.result_url or "",
171171
cached = False,
@@ -241,7 +241,7 @@ async def bypass(self, url: str, *, refresh: bool = False) -> BypassResult: # t
241241
raise BypassToolsError("url is required", "MISSING_URL")
242242
data = await self._arequest("POST", "/bypass/direct", {"url": url, "refresh": refresh})
243243
return BypassResult(
244-
result_url = data.get("result", ""),
244+
result_url = data.get("resultUrl") or data.get("result", ""),
245245
cached = data.get("cached", False),
246246
process_time = data.get("processTime"),
247247
request_id = data.get("requestId"),
@@ -270,7 +270,7 @@ async def bypass_async( # type: ignore[override]
270270
while asyncio.get_event_loop().time() < deadline:
271271
await asyncio.sleep(poll_interval)
272272
result = await self.get_task_result(task_id)
273-
if result.status == "completed":
273+
if result.status in ("completed", "success"):
274274
return BypassResult(result_url=result.result_url or "", cached=False, process_time=None, request_id=task_id)
275275
if result.status == "failed":
276276
raise BypassToolsError(result.error or "Task failed", "TASK_FAILED")
4.27 KB
Binary file not shown.

dist/bypasstools-1.0.0.tar.gz

3.89 KB
Binary file not shown.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
22
requires = ["setuptools>=68", "wheel"]
3-
build-backend = "setuptools.backends.legacy:build"
3+
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "bypasstools"

0 commit comments

Comments
 (0)