PlaywrightCapture 1.42.0__tar.gz → 1.42.2__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.4
2
2
  Name: PlaywrightCapture
3
- Version: 1.42.0
3
+ Version: 1.42.2
4
4
  Summary: A simple library to capture websites using playwright
5
5
  License-Expression: BSD-3-Clause
6
6
  License-File: LICENSE
@@ -20,11 +20,12 @@ Classifier: Topic :: Security
20
20
  Provides-Extra: recaptcha
21
21
  Requires-Dist: SpeechRecognition (>=3.17.0) ; extra == "recaptcha"
22
22
  Requires-Dist: aiohttp-socks (>=0.12.0)
23
- Requires-Dist: aiohttp[speedups] (>=3.14.3)
23
+ Requires-Dist: aiohttp[speedups] (>=3.14.5)
24
24
  Requires-Dist: async-timeout (>=5.0.1) ; python_version < "3.11"
25
25
  Requires-Dist: beautifulsoup4[charset-normalizer,lxml] (>=4.15.0)
26
26
  Requires-Dist: charset-normalizer (>=3.4.6,<4.0.0)
27
- Requires-Dist: dnspython (>=2.7.0,<3.0.0)
27
+ Requires-Dist: dnspython (>=2.8.0,<2.9.0) ; python_version == "3.10"
28
+ Requires-Dist: dnspython (>=2.9.0,<3.0.0) ; python_version >= "3.11" and python_version < "4.0"
28
29
  Requires-Dist: lookyloo-models (>=0.4.7)
29
30
  Requires-Dist: orjson (>=3.12,<4.0.0)
30
31
  Requires-Dist: playwright (>=1.63.0)
@@ -546,12 +546,17 @@ class Capture():
546
546
  async def initialize_context(self) -> None:
547
547
  device_context_settings = {}
548
548
  vp: dict[str, int] | None = None
549
+ no_viewport = True
549
550
  if self.device_name:
550
551
  device_context_settings = self.playwright.devices[self.device_name]
551
552
  # We need to make sure the device_context_settings dict doesn't contains
552
553
  # keys that are set by default in the context creation
553
554
  ua = device_context_settings.pop('user_agent', self._user_agent)
554
555
  vp = device_context_settings.pop('viewport', self._viewport)
556
+ # NOTE 2026-10-13: cannot set no_viewport if either scale factor or ismobile are set:
557
+ # https://github.com/microsoft/playwright/blob/a3401cfe0dcf317101572d025fa46248d0779b42/packages/playwright-core/src/server/browserContext.ts#L755
558
+ if 'device_scale_factor' in device_context_settings or 'is_mobile' in device_context_settings:
559
+ no_viewport = False
555
560
  else:
556
561
  ua = self._user_agent
557
562
  vp = self._viewport
@@ -565,12 +570,14 @@ class Capture():
565
570
  # self._env.update({'DEBUG': 'pw:protocol'})
566
571
  # Playwright bug: https://github.com/microsoft/playwright/issues/40149
567
572
  # So skip the viewport for now, it's not a very big deal.
568
- if self.remote_headfull and self.browser_name == 'webkit':
569
- vp = None
573
+ # if self.remote_headfull and self.browser_name == 'webkit':
574
+ # vp = None
575
+
570
576
  self.context = await self.browser.new_context(
571
577
  record_har_path=self._temp_harfile.name,
572
578
  ignore_https_errors=True,
573
579
  bypass_csp=True,
580
+ no_viewport=no_viewport, # Allows resize in headfull mode.
574
581
  java_script_enabled=self._java_script_enabled,
575
582
  http_credentials=self._http_credentials, # type: ignore[arg-type]
576
583
  user_agent=ua,
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  import asyncio
6
6
  import socket
7
+ import sys
7
8
 
8
9
  from typing import TYPE_CHECKING
9
10
 
@@ -11,7 +12,14 @@ import dns
11
12
 
12
13
  from dns.asyncresolver import Resolver
13
14
  from dns.resolver import Cache
14
- from dns._asyncio_backend import _maybe_wait_for, StreamSocket, Backend
15
+ from dns._asyncio_backend import _maybe_wait_for, Backend
16
+ if sys.version_info < (3, 11):
17
+ # version('dnspython') == '2.8.0'
18
+ from dns._asyncio_backend import StreamSocket as _StreamSocket
19
+ else:
20
+ # Prepare for dnspython 2.9, discard support for 2.8 as soon as possible
21
+ from dns._asyncio_backend import _StreamSocket
22
+
15
23
  from python_socks.async_.asyncio import Proxy
16
24
 
17
25
 
@@ -59,7 +67,7 @@ class Socks5Backend(Backend):
59
67
  ),
60
68
  timeout,
61
69
  )
62
- return StreamSocket(af, r, w) # type: ignore[no-untyped-call]
70
+ return _StreamSocket(af, r, w) # type: ignore[no-untyped-call]
63
71
  raise NotImplementedError(
64
72
  "unsupported socket " + f"type {socktype}"
65
73
  ) # pragma: no cover
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "PlaywrightCapture"
3
- version = "1.42.0"
3
+ version = "1.42.2"
4
4
  description = "A simple library to capture websites using playwright"
5
5
  authors = [
6
6
  {name="Raphaël Vinot", email= "raphael.vinot@circl.lu"}
@@ -17,10 +17,11 @@ dependencies = [
17
17
  "w3lib (>=2.5.0)",
18
18
  "playwright-stealth (>=2.0.3)",
19
19
  "async-timeout (>=5.0.1) ; python_version < \"3.11\"",
20
- "aiohttp[speedups] (>=3.14.3)",
20
+ "aiohttp[speedups] (>=3.14.5)",
21
21
  "aiohttp-socks (>=0.12.0)",
22
22
  "typing-extensions (>=4.12.2,<5.0.0) ; python_version < \"3.12\"",
23
- "dnspython (>=2.7.0,<3.0.0)",
23
+ "dnspython (>=2.8.0,<2.9.0) ; python_version == '3.10'",
24
+ "dnspython (>=2.9.0,<3.0.0) ; python_version >= \"3.11\" and python_version < \"4.0\"",
24
25
  "python-socks (>=3.0.0,<4.0.0)",
25
26
  "rfc3161-client (>=1.0.4,<2.0.0)",
26
27
  "orjson (>=3.12,<4.0.0)",
@@ -54,7 +55,7 @@ types-beautifulsoup4 = "^4.12.0.20250516"
54
55
  pytest = "^9.1.1"
55
56
  mypy = "^2.4.0"
56
57
  types-dateparser = "^1.4.3.20260907"
57
- types-pytz = "^2026.4.0.20260926"
58
+ types-pytz = "^2026.5.0.20261006"
58
59
 
59
60
 
60
61
  [build-system]