lacuscore 1.5.11__py3-none-any.whl → 1.5.12__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.
lacuscore/lacuscore.py CHANGED
@@ -17,6 +17,7 @@ import zlib
17
17
 
18
18
  from asyncio import Task
19
19
  from base64 import b64decode, b64encode
20
+ from datetime import date
20
21
  from enum import IntEnum, unique
21
22
  from logging import LoggerAdapter
22
23
  from pathlib import Path
@@ -424,6 +425,7 @@ class LacusCore():
424
425
 
425
426
  logger = LacusCoreLogAdapter(self.master_logger, {'uuid': uuid})
426
427
  self.redis.zadd('lacus:ongoing', {uuid: time.time()})
428
+ today = date.today().isoformat()
427
429
 
428
430
  retry = False
429
431
  try:
@@ -572,6 +574,12 @@ class LacusCore():
572
574
  rendered_hostname_only=to_capture.get('rendered_hostname_only', True),
573
575
  max_depth_capture_time=self.max_capture_time),
574
576
  timeout=self.max_capture_time)
577
+ if 'error' in playwright_result and 'error_name' in playwright_result:
578
+ # generate stats
579
+ if playwright_result['error_name'] is not None:
580
+ self.redis.zincrby(f'stats:{today}:errors', 1, playwright_result['error_name'])
581
+ # Expire it in 10 days
582
+ self.redis.expire(f'stats:{today}:errors', 3600 * 24 * 10)
575
583
  except PlaywrightCaptureException as e:
576
584
  logger.exception(f'Invalid parameters for the capture of {url} - {e}')
577
585
  result = {'error': f'Invalid parameters for the capture of {url} - {e}'}
@@ -607,6 +615,8 @@ class LacusCore():
607
615
  else:
608
616
  error_msg = result['error'] if result.get('error') else 'Unknown error'
609
617
  logger.info(f'Retried too many times {url}: {error_msg}')
618
+ self.redis.sadd(f'stats:{today}:retry_failed', url)
619
+ self.redis.expire(f'stats:{today}:retry_failed', 3600 * 24 * 10)
610
620
 
611
621
  except CaptureError:
612
622
  if not result:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lacuscore
3
- Version: 1.5.11
3
+ Version: 1.5.12
4
4
  Summary: Core of Lacus, usable as a module
5
5
  Home-page: https://github.com/ail-project/LacusCore
6
6
  License: BSD-3-Clause
@@ -24,7 +24,7 @@ Classifier: Topic :: Security
24
24
  Provides-Extra: docs
25
25
  Requires-Dist: Sphinx (>=7.0.1,<8.0.0) ; extra == "docs"
26
26
  Requires-Dist: defang (>=0.5.3,<0.6.0)
27
- Requires-Dist: playwrightcapture[recaptcha] (>=1.20.7,<2.0.0)
27
+ Requires-Dist: playwrightcapture[recaptcha] (>=1.20.8,<2.0.0)
28
28
  Requires-Dist: redis[hiredis] (>=4.5.5,<5.0.0)
29
29
  Requires-Dist: requests (>=2.31.0,<3.0.0)
30
30
  Requires-Dist: ua-parser (>=0.16.1,<0.17.0)
@@ -1,9 +1,9 @@
1
1
  README.md,sha256=NVr2b3eX2dwOO917TtyGGhCTLtmFbLCFPy9MH8JPUMU,941
2
2
  lacuscore/__init__.py,sha256=ytBrQRBXO1Q5yV72qyS16Q7Auqebl3EMhhLQUa0Sg4g,169
3
3
  lacuscore/lacus_monitoring.py,sha256=xFf90uXF2yEB_eV-Lh82g9cO1tHkPhTCcSZJ3p6_980,1105
4
- lacuscore/lacuscore.py,sha256=R5hAn0JmEiydObOJr55KCTYPvsa4USjzW9dzS23-xgY,31022
4
+ lacuscore/lacuscore.py,sha256=JQD_EuGsb49Lz8DnHCS4cRBIqckyJiHfIPpjl5F9Td0,31688
5
5
  lacuscore/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- lacuscore-1.5.11.dist-info/LICENSE,sha256=4C4hLYrIkUD96Ggk-y_Go1Qf7PBZrEm9PSeTGe2nd4s,1516
7
- lacuscore-1.5.11.dist-info/METADATA,sha256=xjP3OUCuCqBC3HUjYTEi2PdtvqJCqAZAiiahI3XLhK8,2358
8
- lacuscore-1.5.11.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
9
- lacuscore-1.5.11.dist-info/RECORD,,
6
+ lacuscore-1.5.12.dist-info/LICENSE,sha256=4C4hLYrIkUD96Ggk-y_Go1Qf7PBZrEm9PSeTGe2nd4s,1516
7
+ lacuscore-1.5.12.dist-info/METADATA,sha256=ImY5JmElpuBoEyPnq8LvuvUTFvbZwBV-5JrGdwZ2Fbk,2358
8
+ lacuscore-1.5.12.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
9
+ lacuscore-1.5.12.dist-info/RECORD,,