hyper-sdk 2.10.0__tar.gz → 2.11.1__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 (31) hide show
  1. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/PKG-INFO +1 -2
  2. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/akamai_input.py +8 -8
  3. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/datadome_input.py +14 -13
  4. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/incapsula_input.py +4 -4
  5. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/kasada_input.py +7 -5
  6. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/session.py +20 -26
  7. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/session_async.py +20 -26
  8. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk.egg-info/PKG-INFO +1 -2
  9. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk.egg-info/requires.txt +0 -1
  10. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/pyproject.toml +2 -3
  11. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/LICENSE +0 -0
  12. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/README.md +0 -0
  13. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/__init__.py +0 -0
  14. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/akamai/__init__.py +0 -0
  15. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/akamai/pixel.py +0 -0
  16. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/akamai/script_path.py +0 -0
  17. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/akamai/sec_cpt.py +0 -0
  18. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/akamai/stop_signal.py +0 -0
  19. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/datadome/__init__.py +0 -0
  20. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/datadome/parse.py +0 -0
  21. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/incapsula/__init__.py +0 -0
  22. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/incapsula/dynamic.py +0 -0
  23. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/incapsula/utmvc.py +0 -0
  24. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/kasada/__init__.py +0 -0
  25. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/kasada/parse.py +0 -0
  26. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/shared.py +0 -0
  27. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk/trustdecision_input.py +0 -0
  28. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk.egg-info/SOURCES.txt +0 -0
  29. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk.egg-info/dependency_links.txt +0 -0
  30. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/hyper_sdk.egg-info/top_level.txt +0 -0
  31. {hyper_sdk-2.10.0 → hyper_sdk-2.11.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyper_sdk
3
- Version: 2.10.0
3
+ Version: 2.11.1
4
4
  Summary: Hyper Solutions Python SDK
5
5
  License: MIT License
6
6
 
@@ -39,7 +39,6 @@ Requires-Dist: idna>=3.6
39
39
  Requires-Dist: jsonpickle>=3.0.3
40
40
  Requires-Dist: PyJWT>=2.8.0
41
41
  Requires-Dist: urllib3>=2.2.1
42
- Requires-Dist: zstandard>=0.24.0
43
42
  Dynamic: license-file
44
43
 
45
44
  # Hyper Solutions SDK - Python Library for Bot Protection Bypass (Akamai, Incapsula, Kasada, DataDome)
@@ -1,35 +1,35 @@
1
1
  class SensorInput:
2
- def __init__(self, abck: str, bmsz: str, version: str, page_url: str, user_agent: str, ip: str, acceptLanguage: str,
3
- context: str, script: str, scriptUrl: str):
2
+ def __init__(self, abck: str, bmsz: str, version: str, page_url: str, user_agent: str, ip: str, accept_language: str,
3
+ context: str, script: str, script_url: str):
4
4
  self.abck = abck
5
5
  self.bmsz = bmsz
6
6
  self.version = version
7
7
  self.page_url = page_url
8
8
  self.user_agent = user_agent
9
9
  self.script = script
10
- self.scriptUrl = scriptUrl
10
+ self.script_url = script_url
11
11
  self.context = context
12
12
  self.ip = ip
13
- self.acceptLanguage = acceptLanguage
13
+ self.accept_language = accept_language
14
14
 
15
15
 
16
16
  class PixelInput:
17
- def __init__(self, user_agent: str, html_var: str, script_var: str, acceptLanguage: str, ip: str):
17
+ def __init__(self, user_agent: str, html_var: str, script_var: str, accept_language: str, ip: str):
18
18
  self.user_agent = user_agent
19
19
  self.html_var = html_var
20
20
  self.script_var = script_var
21
- self.acceptLanguage = acceptLanguage
21
+ self.accept_language = accept_language
22
22
  self.ip = ip
23
23
 
24
24
 
25
25
  class SbsdInput:
26
26
  def __init__(self, index: int, user_agent: str, uuid: str, page_url: str, o_cookie: str, script: str,
27
- acceptLanguage: str, ip: str):
27
+ accept_language: str, ip: str):
28
28
  self.index = index
29
29
  self.user_agent = user_agent
30
30
  self.uuid = uuid
31
31
  self.page_url = page_url
32
32
  self.o_cookie = o_cookie
33
33
  self.script = script
34
- self.acceptLanguage = acceptLanguage
34
+ self.accept_language = accept_language
35
35
  self.ip = ip
@@ -1,6 +1,6 @@
1
1
 
2
2
  class DataDomeSliderInput:
3
- def __init__(self, user_agent: str, device_link: str, html: str, puzzle: str, piece: str, parent_url: str, acceptLanguage: str, ip: str):
3
+ def __init__(self, user_agent: str, device_link: str, html: str, puzzle: str, piece: str, parent_url: str, accept_language: str, ip: str):
4
4
  # UserAgent must be a Chrome Windows User-Agent.
5
5
  self.user_agent = user_agent
6
6
 
@@ -22,7 +22,7 @@ class DataDomeSliderInput:
22
22
  self.piece = piece
23
23
 
24
24
  self.parent_url = parent_url
25
- self.acceptLanguage = acceptLanguage
25
+ self.accept_language = accept_language
26
26
  self.ip = ip
27
27
 
28
28
  def to_dict(self):
@@ -33,13 +33,13 @@ class DataDomeSliderInput:
33
33
  "puzzle": self.puzzle,
34
34
  "piece": self.piece,
35
35
  "parentUrl": self.parent_url,
36
- "acceptLanguage": self.acceptLanguage,
36
+ "acceptLanguage": self.accept_language,
37
37
  "ip": self.ip,
38
38
  }
39
39
 
40
40
 
41
41
  class DataDomeInterstitialInput:
42
- def __init__(self, user_agent: str, device_link: str, html: str, acceptLanguage: str, ip: str):
42
+ def __init__(self, user_agent: str, device_link: str, html: str, accept_language: str, ip: str):
43
43
  # UserAgent must be a Chrome Windows User-Agent.
44
44
  self.user_agent = user_agent
45
45
 
@@ -50,7 +50,7 @@ class DataDomeInterstitialInput:
50
50
  # Html is the response body of the GET request to the DeviceLink
51
51
  self.html = html
52
52
 
53
- self.acceptLanguage = acceptLanguage
53
+ self.accept_language = accept_language
54
54
  self.ip = ip
55
55
 
56
56
  def to_dict(self):
@@ -58,31 +58,32 @@ class DataDomeInterstitialInput:
58
58
  "userAgent": self.user_agent,
59
59
  "deviceLink": self.device_link,
60
60
  "html": self.html,
61
- "acceptLanguage": self.acceptLanguage,
61
+ "acceptLanguage": self.accept_language,
62
62
  "ip": self.ip,
63
63
  }
64
64
 
65
65
 
66
66
  class DataDomeTagsInput:
67
- def __init__(self, user_agent: str, cid: str, ddk: str, referer: str, tags_type: str, version: str, acceptLanguage: str, ip: str):
68
- # UserAgent must be a Chrome Windows User-Agent.
67
+ def __init__(self, user_agent: str, ddk: str, referer: str, tags_type: str, version: str, accept_language: str, ip: str, cid: str = ""):
69
68
  self.user_agent = user_agent
70
69
  self.cid = cid
71
70
  self.ddk = ddk
72
71
  self.referer = referer
73
72
  self.tags_type = tags_type
74
73
  self.version = version
75
- self.acceptLanguage = acceptLanguage
74
+ self.accept_language = accept_language
76
75
  self.ip = ip
77
76
 
78
77
  def to_dict(self):
79
- return {
78
+ data = {
80
79
  "userAgent": self.user_agent,
81
- "cid": self.cid,
82
80
  "ddk": self.ddk,
83
81
  "referer": self.referer,
84
82
  "type": self.tags_type,
85
- "acceptLanguage": self.acceptLanguage,
83
+ "acceptLanguage": self.accept_language,
86
84
  "ip": self.ip,
87
85
  "version": self.version,
88
- }
86
+ }
87
+ if self.cid: # Only include cid if it's not empty
88
+ data["cid"] = self.cid
89
+ return data
@@ -8,11 +8,11 @@ class UtmvcInput:
8
8
  self.script = script
9
9
 
10
10
  class ReeseInput:
11
- def __init__(self, user_agent: str, acceptLanguage: str, ip: str, pageUrl: str, pow: str, script: str, scriptUrl: str = ""):
11
+ def __init__(self, user_agent: str, accept_language: str, ip: str, pageUrl: str, script: str, script_url: str, pow: str = ""):
12
12
  self.user_agent = user_agent
13
- self.acceptLanguage = acceptLanguage
13
+ self.accept_language = accept_language
14
14
  self.ip = ip
15
- self.scriptUrl = scriptUrl
15
+ self.script_url = script_url
16
16
  self.pow = pow
17
17
  self.script = script
18
- self.pageUrl = pageUrl
18
+ self.pageUrl = pageUrl
@@ -1,5 +1,5 @@
1
1
  class KasadaPowInput:
2
- def __init__(self, st: int, ct: str, fc: str, domain: str, work_time: int = None):
2
+ def __init__(self, st: int, ct: str, domain: str, fc: str = "", work_time: int = None):
3
3
  # St is the x-kpsdk-st value returned by the /tl POST request
4
4
  self.st = st
5
5
  # Ct is the x-kpsdk-ct value returned by the /tl POST request
@@ -11,14 +11,16 @@ class KasadaPowInput:
11
11
  self.domain = domain
12
12
 
13
13
  def to_dict(self):
14
- result = {"st": self.st, "ct": self.ct, "fc": self.fc, "domain": self.domain}
14
+ result = {"st": self.st, "ct": self.ct, "domain": self.domain}
15
+ if self.fc: # Only include fc if it's not empty
16
+ result["fc"] = self.fc
15
17
  if self.work_time is not None:
16
18
  result["workTime"] = self.work_time
17
19
  return result
18
20
 
19
21
 
20
22
  class KasadaPayloadInput:
21
- def __init__(self, user_agent: str, ips_link: str, script: str, acceptLanguage: str, ip: str):
23
+ def __init__(self, user_agent: str, ips_link: str, script: str, accept_language: str, ip: str):
22
24
  # UserAgent must be a Chrome Windows User-Agent.
23
25
  self.user_agent = user_agent
24
26
 
@@ -29,7 +31,7 @@ class KasadaPayloadInput:
29
31
  self.script = script
30
32
 
31
33
  # Your accept-language header
32
- self.acceptLanguage = acceptLanguage
34
+ self.accept_language = accept_language
33
35
  self.ip = ip
34
36
 
35
37
  def to_dict(self):
@@ -37,7 +39,7 @@ class KasadaPayloadInput:
37
39
  "userAgent": self.user_agent,
38
40
  "ipsLink": self.ips_link,
39
41
  "script": self.script,
40
- "acceptLanguage": self.acceptLanguage,
42
+ "acceptLanguage": self.accept_language,
41
43
  "ip": self.ip,
42
44
  }
43
45
  return result
@@ -1,10 +1,9 @@
1
1
  """Session class for Hyper Solutions API."""
2
2
 
3
3
  from typing import Optional, Dict, Any, Tuple
4
- from urllib.parse import quote
5
4
  import httpx
6
5
  import json
7
- import zstandard as zstd
6
+ import gzip
8
7
 
9
8
  from .shared import generate_signature, build_headers, validate_response
10
9
  from .akamai_input import SensorInput, PixelInput, SbsdInput
@@ -24,12 +23,7 @@ class Session:
24
23
  self.app_secret = app_secret
25
24
  self.client = httpx.Client() if client is None else client
26
25
  self._owns_client = client is None
27
- self.compression = compression and zstd is not None
28
-
29
- # Initialize zstd compressor and decompressor if available
30
- if self.compression:
31
- self._compressor = zstd.ZstdCompressor(level=3)
32
- self._decompressor = zstd.ZstdDecompressor()
26
+ self.compression = compression
33
27
 
34
28
  def __enter__(self):
35
29
  return self
@@ -64,17 +58,17 @@ class Session:
64
58
  'version': input_data.version,
65
59
  'pageUrl': input_data.page_url,
66
60
  'script': input_data.script,
67
- 'scriptUrl': input_data.scriptUrl,
61
+ 'scriptUrl': input_data.script_url,
68
62
  'context': input_data.context,
69
63
  'ip': input_data.ip,
70
- 'acceptLanguage': input_data.acceptLanguage,
64
+ 'acceptLanguage': input_data.accept_language,
71
65
  }
72
66
  payload = json.dumps(payload_data).encode('utf-8')
73
67
 
74
68
  # Compress payload if large enough
75
69
  payload, use_compression = self._compress_payload(payload)
76
70
  if use_compression:
77
- headers["content-encoding"] = "zstd"
71
+ headers["content-encoding"] = "gzip"
78
72
 
79
73
  response = self.client.post(sensor_endpoint, headers=headers, content=payload)
80
74
 
@@ -102,7 +96,7 @@ class Session:
102
96
  'pageUrl': input_data.page_url,
103
97
  'o': input_data.o_cookie,
104
98
  'script': input_data.script,
105
- 'acceptLanguage': input_data.acceptLanguage,
99
+ 'acceptLanguage': input_data.accept_language,
106
100
  'ip': input_data.ip,
107
101
  'index': input_data.index,
108
102
  })
@@ -123,7 +117,7 @@ class Session:
123
117
  'htmlVar': input_data.html_var,
124
118
  'scriptVar': input_data.script_var,
125
119
  'ip': input_data.ip,
126
- 'acceptLanguage': input_data.acceptLanguage,
120
+ 'acceptLanguage': input_data.accept_language,
127
121
  })
128
122
 
129
123
  def generate_reese84_sensor(self, input_data: ReeseInput) -> str:
@@ -143,9 +137,9 @@ class Session:
143
137
  """
144
138
  return self._send_request("https://incapsula.hypersolutions.co/reese84", {
145
139
  'userAgent': input_data.user_agent,
146
- 'acceptLanguage': input_data.acceptLanguage,
140
+ 'acceptLanguage': input_data.accept_language,
147
141
  'ip': input_data.ip,
148
- 'scriptUrl': input_data.scriptUrl,
142
+ 'scriptUrl': input_data.script_url,
149
143
  'pageUrl': input_data.pageUrl,
150
144
  'pow': input_data.pow,
151
145
  'script': input_data.script,
@@ -179,7 +173,7 @@ class Session:
179
173
  # Compress payload if large enough
180
174
  payload, use_compression = self._compress_payload(payload)
181
175
  if use_compression:
182
- headers["content-encoding"] = "zstd"
176
+ headers["content-encoding"] = "gzip"
183
177
 
184
178
  response = self.client.post("https://incapsula.hypersolutions.co/utmvc", headers=headers, content=payload)
185
179
 
@@ -221,7 +215,7 @@ class Session:
221
215
  # Compress payload if large enough
222
216
  payload, use_compression = self._compress_payload(payload)
223
217
  if use_compression:
224
- headers["content-encoding"] = "zstd"
218
+ headers["content-encoding"] = "gzip"
225
219
 
226
220
  response = self.client.post("https://kasada.hypersolutions.co/payload", headers=headers, content=payload)
227
221
 
@@ -300,7 +294,7 @@ class Session:
300
294
  # Compress payload if large enough
301
295
  payload, use_compression = self._compress_payload(payload)
302
296
  if use_compression:
303
- headers["content-encoding"] = "zstd"
297
+ headers["content-encoding"] = "gzip"
304
298
 
305
299
  response = self.client.post("https://trustdecision.hypersolutions.co/payload", headers=headers, content=payload)
306
300
 
@@ -366,12 +360,12 @@ class Session:
366
360
  headers = build_headers(self.api_key, self.jwt_key, self.app_key, self.app_secret)
367
361
  # Add compression headers
368
362
  if self.compression:
369
- headers["accept-encoding"] = "zstd"
363
+ headers["accept-encoding"] = "gzip"
370
364
  return headers
371
365
 
372
366
  def _compress_payload(self, payload: bytes) -> Tuple[bytes, bool]:
373
367
  """
374
- Compresses the payload using zstd if enabled and payload is large enough.
368
+ Compresses the payload using gzip if enabled and payload is large enough.
375
369
 
376
370
  Args:
377
371
  payload (bytes): The payload to potentially compress
@@ -383,7 +377,7 @@ class Session:
383
377
  return payload, False
384
378
 
385
379
  try:
386
- compressed = self._compressor.compress(payload)
380
+ compressed = gzip.compress(payload, compresslevel=6)
387
381
  return compressed, True
388
382
  except Exception:
389
383
  # Fall back to uncompressed if compression fails
@@ -391,7 +385,7 @@ class Session:
391
385
 
392
386
  def _decompress_response(self, response: httpx.Response) -> bytes:
393
387
  """
394
- Decompresses the response body if it's compressed with zstd.
388
+ Decompresses the response body if it's compressed with gzip.
395
389
 
396
390
  Args:
397
391
  response (httpx.Response): The HTTP response
@@ -402,9 +396,9 @@ class Session:
402
396
  content = response.content
403
397
  content_encoding = response.headers.get("content-encoding", "").lower()
404
398
 
405
- if content_encoding == "zstd" and self.compression:
399
+ if content_encoding == "gzip" and self.compression:
406
400
  try:
407
- return self._decompressor.decompress(content)
401
+ return gzip.decompress(content)
408
402
  except Exception:
409
403
  # Fall back to original content if decompression fails
410
404
  pass
@@ -428,7 +422,7 @@ class Session:
428
422
  # Compress payload if large enough
429
423
  payload, use_compression = self._compress_payload(payload)
430
424
  if use_compression:
431
- headers["content-encoding"] = "zstd"
425
+ headers["content-encoding"] = "gzip"
432
426
 
433
427
  response = self.client.post(url, headers=headers, content=payload)
434
428
 
@@ -455,7 +449,7 @@ class Session:
455
449
  # Compress payload if large enough
456
450
  payload, use_compression = self._compress_payload(payload)
457
451
  if use_compression:
458
- headers["content-encoding"] = "zstd"
452
+ headers["content-encoding"] = "gzip"
459
453
 
460
454
  response = self.client.post(url, headers=headers, content=payload)
461
455
 
@@ -1,10 +1,9 @@
1
1
  """Async version of the Session class for Hyper Solutions API."""
2
2
 
3
3
  from typing import Optional, Dict, Any, Tuple
4
- from urllib.parse import quote
5
4
  import httpx
6
5
  import json
7
- import zstandard as zstd
6
+ import gzip
8
7
 
9
8
  from .shared import generate_signature, build_headers, validate_response
10
9
  from .akamai_input import SensorInput, PixelInput, SbsdInput
@@ -24,12 +23,7 @@ class SessionAsync:
24
23
  self.app_secret = app_secret
25
24
  self.client = client
26
25
  self._owns_client = client is None
27
- self.compression = compression and zstd is not None
28
-
29
- # Initialize zstd compressor and decompressor if available
30
- if self.compression:
31
- self._compressor = zstd.ZstdCompressor(level=3)
32
- self._decompressor = zstd.ZstdDecompressor()
26
+ self.compression = compression
33
27
 
34
28
  async def __aenter__(self):
35
29
  if self._owns_client:
@@ -68,17 +62,17 @@ class SessionAsync:
68
62
  'version': input_data.version,
69
63
  'pageUrl': input_data.page_url,
70
64
  'script': input_data.script,
71
- 'scriptUrl': input_data.scriptUrl,
65
+ 'scriptUrl': input_data.script_url,
72
66
  'context': input_data.context,
73
67
  'ip': input_data.ip,
74
- 'acceptLanguage': input_data.acceptLanguage,
68
+ 'acceptLanguage': input_data.accept_language,
75
69
  }
76
70
  payload = json.dumps(payload_data).encode('utf-8')
77
71
 
78
72
  # Compress payload if large enough
79
73
  payload, use_compression = self._compress_payload(payload)
80
74
  if use_compression:
81
- headers["content-encoding"] = "zstd"
75
+ headers["content-encoding"] = "gzip"
82
76
 
83
77
  response = await self.client.post(sensor_endpoint, headers=headers, content=payload)
84
78
 
@@ -106,7 +100,7 @@ class SessionAsync:
106
100
  'pageUrl': input_data.page_url,
107
101
  'o': input_data.o_cookie,
108
102
  'script': input_data.script,
109
- 'acceptLanguage': input_data.acceptLanguage,
103
+ 'acceptLanguage': input_data.accept_language,
110
104
  'ip': input_data.ip,
111
105
  'index': input_data.index,
112
106
  })
@@ -127,7 +121,7 @@ class SessionAsync:
127
121
  'htmlVar': input_data.html_var,
128
122
  'scriptVar': input_data.script_var,
129
123
  'ip': input_data.ip,
130
- 'acceptLanguage': input_data.acceptLanguage,
124
+ 'acceptLanguage': input_data.accept_language,
131
125
  })
132
126
 
133
127
  async def generate_reese84_sensor(self, input_data: ReeseInput) -> str:
@@ -147,9 +141,9 @@ class SessionAsync:
147
141
  """
148
142
  return await self._send_request("https://incapsula.hypersolutions.co/reese84", {
149
143
  'userAgent': input_data.user_agent,
150
- 'acceptLanguage': input_data.acceptLanguage,
144
+ 'acceptLanguage': input_data.accept_language,
151
145
  'ip': input_data.ip,
152
- 'scriptUrl': input_data.scriptUrl,
146
+ 'scriptUrl': input_data.script_url,
153
147
  'pageUrl': input_data.pageUrl,
154
148
  'pow': input_data.pow,
155
149
  'script': input_data.script,
@@ -184,7 +178,7 @@ class SessionAsync:
184
178
  # Compress payload if large enough
185
179
  payload, use_compression = self._compress_payload(payload)
186
180
  if use_compression:
187
- headers["content-encoding"] = "zstd"
181
+ headers["content-encoding"] = "gzip"
188
182
 
189
183
  response = await self.client.post("https://incapsula.hypersolutions.co/utmvc", headers=headers, content=payload)
190
184
 
@@ -227,7 +221,7 @@ class SessionAsync:
227
221
  # Compress payload if large enough
228
222
  payload, use_compression = self._compress_payload(payload)
229
223
  if use_compression:
230
- headers["content-encoding"] = "zstd"
224
+ headers["content-encoding"] = "gzip"
231
225
 
232
226
  response = await self.client.post("https://kasada.hypersolutions.co/payload", headers=headers, content=payload)
233
227
 
@@ -309,7 +303,7 @@ class SessionAsync:
309
303
  # Compress payload if large enough
310
304
  payload, use_compression = self._compress_payload(payload)
311
305
  if use_compression:
312
- headers["content-encoding"] = "zstd"
306
+ headers["content-encoding"] = "gzip"
313
307
 
314
308
  response = await self.client.post("https://trustdecision.hypersolutions.co/payload", headers=headers, content=payload)
315
309
 
@@ -375,12 +369,12 @@ class SessionAsync:
375
369
  headers = build_headers(self.api_key, self.jwt_key, self.app_key, self.app_secret)
376
370
  # Add compression headers
377
371
  if self.compression:
378
- headers["accept-encoding"] = "zstd"
372
+ headers["accept-encoding"] = "gzip"
379
373
  return headers
380
374
 
381
375
  def _compress_payload(self, payload: bytes) -> Tuple[bytes, bool]:
382
376
  """
383
- Compresses the payload using zstd if enabled and payload is large enough.
377
+ Compresses the payload using gzip if enabled and payload is large enough.
384
378
 
385
379
  Args:
386
380
  payload (bytes): The payload to potentially compress
@@ -392,7 +386,7 @@ class SessionAsync:
392
386
  return payload, False
393
387
 
394
388
  try:
395
- compressed = self._compressor.compress(payload)
389
+ compressed = gzip.compress(payload, compresslevel=6)
396
390
  return compressed, True
397
391
  except Exception:
398
392
  # Fall back to uncompressed if compression fails
@@ -400,7 +394,7 @@ class SessionAsync:
400
394
 
401
395
  def _decompress_response(self, response: httpx.Response) -> bytes:
402
396
  """
403
- Decompresses the response body if it's compressed with zstd.
397
+ Decompresses the response body if it's compressed with gzip.
404
398
 
405
399
  Args:
406
400
  response (httpx.Response): The HTTP response
@@ -411,9 +405,9 @@ class SessionAsync:
411
405
  content = response.content
412
406
  content_encoding = response.headers.get("content-encoding", "").lower()
413
407
 
414
- if content_encoding == "zstd" and self.compression:
408
+ if content_encoding == "gzip" and self.compression:
415
409
  try:
416
- return self._decompressor.decompress(content)
410
+ return gzip.decompress(content)
417
411
  except Exception:
418
412
  # Fall back to original content if decompression fails
419
413
  pass
@@ -438,7 +432,7 @@ class SessionAsync:
438
432
  # Compress payload if large enough
439
433
  payload, use_compression = self._compress_payload(payload)
440
434
  if use_compression:
441
- headers["content-encoding"] = "zstd"
435
+ headers["content-encoding"] = "gzip"
442
436
 
443
437
  response = await self.client.post(url, headers=headers, content=payload)
444
438
 
@@ -466,7 +460,7 @@ class SessionAsync:
466
460
  # Compress payload if large enough
467
461
  payload, use_compression = self._compress_payload(payload)
468
462
  if use_compression:
469
- headers["content-encoding"] = "zstd"
463
+ headers["content-encoding"] = "gzip"
470
464
 
471
465
  response = await self.client.post(url, headers=headers, content=payload)
472
466
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyper_sdk
3
- Version: 2.10.0
3
+ Version: 2.11.1
4
4
  Summary: Hyper Solutions Python SDK
5
5
  License: MIT License
6
6
 
@@ -39,7 +39,6 @@ Requires-Dist: idna>=3.6
39
39
  Requires-Dist: jsonpickle>=3.0.3
40
40
  Requires-Dist: PyJWT>=2.8.0
41
41
  Requires-Dist: urllib3>=2.2.1
42
- Requires-Dist: zstandard>=0.24.0
43
42
  Dynamic: license-file
44
43
 
45
44
  # Hyper Solutions SDK - Python Library for Bot Protection Bypass (Akamai, Incapsula, Kasada, DataDome)
@@ -5,4 +5,3 @@ idna>=3.6
5
5
  jsonpickle>=3.0.3
6
6
  PyJWT>=2.8.0
7
7
  urllib3>=2.2.1
8
- zstandard>=0.24.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hyper_sdk"
7
- version = "2.10.0"
7
+ version = "2.11.1"
8
8
  description = "Hyper Solutions Python SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
@@ -21,8 +21,7 @@ dependencies = [
21
21
  "idna>=3.6",
22
22
  "jsonpickle>=3.0.3",
23
23
  "PyJWT>=2.8.0",
24
- "urllib3>=2.2.1",
25
- "zstandard>=0.24.0"
24
+ "urllib3>=2.2.1"
26
25
  ]
27
26
  license = {file = "LICENSE"}
28
27
 
File without changes
File without changes
File without changes