Skip to content

Commit 9a7303e

Browse files
committed
fix: add User-Agent header, correct result field order, bump to 1.0.2
1 parent 7c58c16 commit 9a7303e

7 files changed

Lines changed: 10 additions & 5 deletions

File tree

bypasstools.egg-info/PKG-INFO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.2
22
Name: bypasstools
3-
Version: 1.0.1
3+
Version: 1.0.2
44
Summary: Official Python SDK for the BypassTools API
55
Author-email: BypassTools <support@bypass.tools>
66
License: MIT

bypasstools/client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def _request(self, method: str, path: str, body: Optional[dict] = None) -> dict:
7777
headers={
7878
"x-api-key": self._api_key,
7979
"Content-Type": "application/json",
80+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
8081
},
8182
)
8283
try:
@@ -111,7 +112,7 @@ def bypass(self, url: str, *, refresh: bool = False) -> BypassResult:
111112
raise BypassToolsError("url is required", "MISSING_URL")
112113
data = self._request("POST", "/bypass/direct", {"url": url, "refresh": refresh})
113114
return BypassResult(
114-
result_url = data.get("resultUrl") or data.get("result", ""),
115+
result_url = data.get("result") or data.get("resultUrl", ""),
115116
cached = data.get("cached", False),
116117
process_time = data.get("processTime"),
117118
request_id = data.get("requestId"),
@@ -218,7 +219,11 @@ async def _arequest(self, method: str, path: str, body: Optional[dict] = None) -
218219
kwargs = {
219220
"method": method,
220221
"url": url,
221-
"headers": {"x-api-key": self._api_key, "Content-Type": "application/json"},
222+
"headers": {
223+
"x-api-key": self._api_key,
224+
"Content-Type": "application/json",
225+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
226+
},
222227
"timeout": aiohttp.ClientTimeout(total=self._timeout),
223228
}
224229
if body:
@@ -241,7 +246,7 @@ async def bypass(self, url: str, *, refresh: bool = False) -> BypassResult: # t
241246
raise BypassToolsError("url is required", "MISSING_URL")
242247
data = await self._arequest("POST", "/bypass/direct", {"url": url, "refresh": refresh})
243248
return BypassResult(
244-
result_url = data.get("resultUrl") or data.get("result", ""),
249+
result_url = data.get("result") or data.get("resultUrl", ""),
245250
cached = data.get("cached", False),
246251
process_time = data.get("processTime"),
247252
request_id = data.get("requestId"),
-5.03 KB
Binary file not shown.

dist/bypasstools-1.0.1.tar.gz

-4.64 KB
Binary file not shown.
5.14 KB
Binary file not shown.

dist/bypasstools-1.0.2.tar.gz

4.75 KB
Binary file not shown.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "bypasstools"
7-
version = "1.0.1"
7+
version = "1.0.2"
88
description = "Official Python SDK for the BypassTools API"
99
readme = "README.md"
1010
license = { text = "MIT" }

0 commit comments

Comments
 (0)