PlaywrightCapture 1.25.5__tar.gz → 1.25.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PlaywrightCapture
3
- Version: 1.25.5
3
+ Version: 1.25.6
4
4
  Summary: A simple library to capture websites using playwright
5
5
  Home-page: https://github.com/Lookyloo/PlaywrightCapture
6
6
  License: BSD-3-Clause
@@ -31,7 +31,7 @@ Requires-Dist: playwright-stealth (>=1.0.6,<2.0.0)
31
31
  Requires-Dist: puremagic (>=1.26,<2.0)
32
32
  Requires-Dist: pydub (>=0.25.1,<0.26.0) ; extra == "recaptcha"
33
33
  Requires-Dist: pytz (>=2024.1,<2025.0) ; python_version < "3.9"
34
- Requires-Dist: setuptools (>=70.3.0,<71.0.0)
34
+ Requires-Dist: setuptools (>=71.0.3,<72.0.0)
35
35
  Requires-Dist: tzdata (>=2024.1,<2025.0)
36
36
  Requires-Dist: w3lib (>=2.2.1,<3.0.0)
37
37
  Project-URL: Repository, https://github.com/Lookyloo/PlaywrightCapture
@@ -339,19 +339,10 @@ class Capture():
339
339
  return self._headers
340
340
 
341
341
  @headers.setter
342
- def headers(self, headers: str | dict[str, str] | None) -> None:
342
+ def headers(self, headers: dict[str, str] | None) -> None:
343
343
  if not headers:
344
344
  return
345
- if isinstance(headers, str):
346
- new_headers: dict[str, str] = {}
347
- for header_line in headers.splitlines():
348
- if header_line and ':' in header_line:
349
- splitted = header_line.split(':', 1)
350
- if splitted and len(splitted) == 2:
351
- header, h_value = splitted
352
- if header.strip() and h_value.strip():
353
- new_headers[header.strip()] = h_value.strip()
354
- elif isinstance(headers, dict):
345
+ if isinstance(headers, dict):
355
346
  # Check if they are valid
356
347
  new_headers = {name.strip(): value.strip() for name, value in headers.items() if isinstance(name, str) and isinstance(value, str) and name.strip() and value.strip()}
357
348
  if new_headers != headers:
@@ -1096,7 +1087,7 @@ class Capture():
1096
1087
  try:
1097
1088
  async with timeout(30):
1098
1089
  return await page.content()
1099
- except (Error, TimeoutError):
1090
+ except (Error, TimeoutError, asyncio.TimeoutError):
1100
1091
  self.logger.debug('Unable to get page content, trying again.')
1101
1092
  tries -= 1
1102
1093
  await self._wait_for_random_timeout(page, 1)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "PlaywrightCapture"
3
- version = "1.25.5"
3
+ version = "1.25.6"
4
4
  description = "A simple library to capture websites using playwright"
5
5
  authors = ["Raphaël Vinot <raphael.vinot@circl.lu>"]
6
6
  license = "BSD-3-Clause"
@@ -28,7 +28,7 @@ SpeechRecognition = {version = "^3.10.4", optional = true}
28
28
  pytz = {"version" = "^2024.1", python = "<3.9"}
29
29
  tzdata = "^2024.1"
30
30
  playwright-stealth = "^1.0.6"
31
- setuptools = "^70.3.0"
31
+ setuptools = "^71.0.3"
32
32
  puremagic = "^1.26"
33
33
  async-timeout = {version = "^4.0.3", python = "<3.11"}
34
34
  aiohttp = {extras = ["speedups"], version = "^3.9.5"}