PlaywrightCapture 1.25.6__py3-none-any.whl → 1.25.8__py3-none-any.whl

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.
@@ -404,17 +404,27 @@ class Capture():
404
404
  device_context_settings = {}
405
405
  if self.device_name:
406
406
  device_context_settings = self.playwright.devices[self.device_name]
407
+ # We need to make sure the device_context_settings dict doesn't contains
408
+ # keys that are set by default in the context creation
409
+ if context_ua := device_context_settings.pop('user_agent', None):
410
+ ua = self.user_agent if self.user_agent else context_ua
411
+ if context_vp := device_context_settings.pop('viewport', self._default_viewport):
412
+ # Always true, but we also always want to pop it.
413
+ vp = self.viewport if self.viewport else context_vp
414
+ else:
415
+ ua = self.user_agent
416
+ vp = self.viewport
407
417
 
408
418
  self.context = await self.browser.new_context(
409
419
  record_har_path=self._temp_harfile.name,
410
420
  ignore_https_errors=True,
411
421
  bypass_csp=True,
412
422
  http_credentials=self.http_credentials if self.http_credentials else None,
413
- user_agent=self.user_agent if self.user_agent else device_context_settings.pop('user_agent', None),
423
+ user_agent=ua,
414
424
  locale=self.locale if self.locale else None,
415
425
  timezone_id=self.timezone_id if self.timezone_id else None,
416
426
  color_scheme=self.color_scheme if self.color_scheme else None,
417
- viewport=self.viewport if self.viewport else device_context_settings.pop('viewport', self._default_viewport),
427
+ viewport=vp,
418
428
  # For debug only
419
429
  # record_video_dir='./videos/',
420
430
  **device_context_settings
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PlaywrightCapture
3
- Version: 1.25.6
3
+ Version: 1.25.8
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 (>=71.0.3,<72.0.0)
34
+ Requires-Dist: setuptools (>=71.1.0,<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
@@ -1,9 +1,9 @@
1
1
  playwrightcapture/__init__.py,sha256=F90Y8wYS13tDjgsfjuFrCfmzQfdnH44G-ovuilJfLEE,511
2
- playwrightcapture/capture.py,sha256=JYL2tcDz1OVQE2hpCnSa3xSqos6_v6t9CCLnVLfxBSw,70420
2
+ playwrightcapture/capture.py,sha256=DzAx7xwF5IbYfIOt-4gzppc9Qzc1jadk93zN8PtVJZQ,70846
3
3
  playwrightcapture/exceptions.py,sha256=LhGJQCGHzEu7Sx2Dfl28OFeDg1OmrwufFjAWXlxQnEA,366
4
4
  playwrightcapture/helpers.py,sha256=SXQLEuxMs8-bcWykMiUVosHzzxBKuS-QC0gBV3OmKmo,1764
5
5
  playwrightcapture/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- playwrightcapture-1.25.6.dist-info/LICENSE,sha256=uwFc39fTLacBUG-XTuxX6IQKTKhg4z14gWOLt3ex4Ho,1775
7
- playwrightcapture-1.25.6.dist-info/METADATA,sha256=59DKFDY5h7uAIeghIFZtV6iTgt8CiRmHiBrx8soZiF8,3173
8
- playwrightcapture-1.25.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
9
- playwrightcapture-1.25.6.dist-info/RECORD,,
6
+ playwrightcapture-1.25.8.dist-info/LICENSE,sha256=uwFc39fTLacBUG-XTuxX6IQKTKhg4z14gWOLt3ex4Ho,1775
7
+ playwrightcapture-1.25.8.dist-info/METADATA,sha256=508SCjk5btHdQCfQrrivoGA7s-X-LY1TAv6Qp_HyeOE,3173
8
+ playwrightcapture-1.25.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
9
+ playwrightcapture-1.25.8.dist-info/RECORD,,