PlaywrightCapture 1.41.1__tar.gz → 1.41.3__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.41.1
3
+ Version: 1.41.3
4
4
  Summary: A simple library to capture websites using playwright
5
5
  License-Expression: BSD-3-Clause
6
6
  License-File: LICENSE
@@ -1237,9 +1237,10 @@ class Capture():
1237
1237
  self.should_retry = True
1238
1238
 
1239
1239
  # Collect storage state, including IndexedDB, to capture the full browser state.
1240
+ # 2026-09-08: add WebAuth credentials
1240
1241
  try:
1241
1242
  async with timeout(15):
1242
- to_return['storage'] = await self.context.storage_state(indexed_db=True)
1243
+ to_return['storage'] = await self.context.storage_state(indexed_db=True, credentials=True)
1243
1244
  except (TimeoutError, asyncio.TimeoutError):
1244
1245
  self.logger.warning("Unable to get storage (timeout).")
1245
1246
  errors.append("Unable to get the storage (timeout).")
@@ -1397,8 +1398,8 @@ class Capture():
1397
1398
  await route.continue_()
1398
1399
  else:
1399
1400
  # other URLs
1400
- not_local, message = self.__check_local_url(request.url)
1401
- if not_local:
1401
+ public, message = self.__check_local_url(request.url)
1402
+ if public:
1402
1403
  await route.continue_()
1403
1404
  else:
1404
1405
  await route.fulfill(status=404, content_type="text/plain", body=message)
@@ -2294,6 +2295,15 @@ class Capture():
2294
2295
  In the meantime, we try to get all the potential ones in this method.
2295
2296
  Method inspired by https://github.com/ail-project/ail-framework/blob/master/bin/lib/crawlers.py
2296
2297
  """
2298
+ async def __check_local_middleware(req: aiohttp.ClientRequest, handler: aiohttp.ClientHandlerType) -> aiohttp.ClientResponse:
2299
+ if self.only_global_lookup:
2300
+ public, message = self.__check_local_url(str(req.url))
2301
+ if public is False:
2302
+ # got a local URL
2303
+ self.logger.warning(f'Attempted to get a local favicon (in redirect): {message}')
2304
+ raise aiohttp.ClientError(f'Attempted to get a local favicon (in redirect): {message}')
2305
+ return await handler(req)
2306
+
2297
2307
  connector = None
2298
2308
  if self.proxy:
2299
2309
  # NOTE 2024-05-17: switch to async to fetch, the lib uses socks5h by default
@@ -2319,8 +2329,8 @@ class Capture():
2319
2329
  continue
2320
2330
 
2321
2331
  if self.only_global_lookup:
2322
- not_local, message = self.__check_local_url(url_to_fetch)
2323
- if not_local is False:
2332
+ public, message = self.__check_local_url(url_to_fetch)
2333
+ if public is False:
2324
2334
  # got a local URL
2325
2335
  self.logger.warning(f'Attempted to get a local favicon: {message}')
2326
2336
  continue
@@ -2328,7 +2338,7 @@ class Capture():
2328
2338
  if url_to_fetch in self._requests:
2329
2339
  favicon = self._requests[url_to_fetch]
2330
2340
  if not favicon:
2331
- async with session.get(url_to_fetch, ssl=False) as favicon_response:
2341
+ async with session.get(url_to_fetch, ssl=False, middlewares=[__check_local_middleware]) as favicon_response:
2332
2342
  favicon_response.raise_for_status()
2333
2343
  favicon = await favicon_response.read()
2334
2344
  if favicon:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "PlaywrightCapture"
3
- version = "1.41.1"
3
+ version = "1.41.3"
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"}
@@ -53,7 +53,7 @@ recaptcha = [
53
53
  types-beautifulsoup4 = "^4.12.0.20250516"
54
54
  pytest = "^9.1.1"
55
55
  mypy = "^2.3.1"
56
- types-dateparser = "^1.4.2.20260813"
56
+ types-dateparser = "^1.4.3.20260907"
57
57
  types-pytz = "^2026.3.1.20260727"
58
58
 
59
59