PlaywrightCapture 1.31.7__py3-none-any.whl → 1.32.0__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.
@@ -234,8 +234,6 @@ class Capture():
234
234
 
235
235
  async def __aenter__(self) -> Capture:
236
236
  '''Launch the browser'''
237
- self._temp_harfile = NamedTemporaryFile(delete=False)
238
-
239
237
  self.playwright = await async_playwright().start()
240
238
 
241
239
  if self.device_name:
@@ -255,11 +253,12 @@ class Capture():
255
253
  # Set of URLs that were captured in that context
256
254
  self._already_captured: set[str] = set()
257
255
 
256
+ # Create the temporary file to store the HAR content.
257
+ self._temp_harfile = NamedTemporaryFile(delete=False, prefix="playwright_capture_har", suffix=".json")
258
+
258
259
  return self
259
260
 
260
261
  async def __aexit__(self, exc_type: Any, exc: Any, tb: Any) -> bool:
261
- if hasattr(self, '_temp_harfile'):
262
- os.unlink(self._temp_harfile.name)
263
262
 
264
263
  try:
265
264
  await self.browser.close(reason="Closing browser at the end of the capture.")
@@ -271,6 +270,13 @@ class Capture():
271
270
  except Exception as e:
272
271
  # this should't happen, but just in case it does...
273
272
  self.logger.info(f'Unable to stop playwright: {e}')
273
+
274
+ if hasattr(self, '_temp_harfile'):
275
+ try:
276
+ os.unlink(self._temp_harfile.name)
277
+ except Exception as e:
278
+ self.logger.warning(f'Unable to remove temp HAR file {self._temp_harfile.name}: {e}')
279
+
274
280
  return True
275
281
 
276
282
  @property
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: PlaywrightCapture
3
- Version: 1.31.7
3
+ Version: 1.32.0
4
4
  Summary: A simple library to capture websites using playwright
5
5
  License: BSD-3-Clause
6
6
  Author: Raphaël Vinot
@@ -20,9 +20,9 @@ Classifier: Topic :: Security
20
20
  Provides-Extra: recaptcha
21
21
  Requires-Dist: SpeechRecognition (>=3.14.3) ; extra == "recaptcha"
22
22
  Requires-Dist: aiohttp-socks (>=0.10.1)
23
- Requires-Dist: aiohttp[speedups] (>=3.12.14)
23
+ Requires-Dist: aiohttp[speedups] (>=3.12.15)
24
24
  Requires-Dist: async-timeout (>=5.0.1) ; python_version < "3.11"
25
- Requires-Dist: beautifulsoup4[charset-normalizer,lxml] (>=4.13.4)
25
+ Requires-Dist: beautifulsoup4[charset-normalizer,lxml] (>=4.13.5)
26
26
  Requires-Dist: dateparser (>=1.2.2)
27
27
  Requires-Dist: dnspython (>=2.7.0,<3.0.0)
28
28
  Requires-Dist: playwright (>=1.54.0)
@@ -1,10 +1,10 @@
1
1
  playwrightcapture/__init__.py,sha256=NAL0-ymloDBm_ghp1PsefIwRMQmEFKPhn83WVUD7t_0,663
2
- playwrightcapture/capture.py,sha256=rcMfnkp7s2WQX0VYhdjSBUFkTYoBDg9GWeBb3THD9QI,88651
2
+ playwrightcapture/capture.py,sha256=yPGhrhFrwKS7mlTeMw_acYIjlDHZnAR0psOdXKoi4Lw,88922
3
3
  playwrightcapture/exceptions.py,sha256=LhGJQCGHzEu7Sx2Dfl28OFeDg1OmrwufFjAWXlxQnEA,366
4
4
  playwrightcapture/helpers.py,sha256=Xqs09zHhzAWnpBtQ0A9YAxg80P3Lj7aBj5M2WuEr0so,1843
5
5
  playwrightcapture/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  playwrightcapture/socks5dnslookup.py,sha256=ZpOf8tgsRQZi-WDcn9JbbG1bKz9DSfK_jz1l53UI1Ho,4058
7
- playwrightcapture-1.31.7.dist-info/LICENSE,sha256=uwFc39fTLacBUG-XTuxX6IQKTKhg4z14gWOLt3ex4Ho,1775
8
- playwrightcapture-1.31.7.dist-info/METADATA,sha256=BTM3AQGpFYhcy7Eq6ZwqVlpKwYQd3m1x5ft2QoLySBs,3285
9
- playwrightcapture-1.31.7.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
10
- playwrightcapture-1.31.7.dist-info/RECORD,,
7
+ playwrightcapture-1.32.0.dist-info/LICENSE,sha256=uwFc39fTLacBUG-XTuxX6IQKTKhg4z14gWOLt3ex4Ho,1775
8
+ playwrightcapture-1.32.0.dist-info/METADATA,sha256=2xaXTHpeA5DICsbA2k7ygsPrjOGZzLlSiYc6tl6h33E,3285
9
+ playwrightcapture-1.32.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
10
+ playwrightcapture-1.32.0.dist-info/RECORD,,