lacuscore 1.12.9__py3-none-any.whl → 1.12.10__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/helpers.py CHANGED
@@ -105,6 +105,7 @@ class CaptureSettings(BaseModel):
105
105
  referer: str | None = None
106
106
  with_favicon: bool = True
107
107
  allow_tracking: bool = False
108
+ headless: bool = True
108
109
  force: bool = False
109
110
  recapture_interval: int = 300
110
111
  priority: int = 0
lacuscore/lacuscore.py CHANGED
@@ -95,15 +95,19 @@ class LacusCore():
95
95
  tor_proxy: str | None=None,
96
96
  only_global_lookups: bool=True,
97
97
  max_retries: int=3,
98
+ headed_allowed: bool=False,
98
99
  loglevel: str | int='INFO') -> None:
99
100
  self.master_logger = logging.getLogger(f'{self.__class__.__name__}')
100
101
  self.master_logger.setLevel(loglevel)
102
+
101
103
  self.redis = redis_connector
102
104
  self.max_capture_time = max_capture_time
103
105
  self.expire_results = expire_results
104
106
  self.tor_proxy = tor_proxy
105
107
  self.only_global_lookups = only_global_lookups
106
108
  self.max_retries = max_retries
109
+ self.headed_allowed = headed_allowed
110
+
107
111
  self.dnsresolver: Resolver = Resolver()
108
112
  self.dnsresolver.cache = Cache(900)
109
113
  self.dnsresolver.timeout = 2
@@ -139,6 +143,7 @@ class LacusCore():
139
143
  rendered_hostname_only: bool=True,
140
144
  with_favicon: bool=False,
141
145
  allow_tracking: bool=False,
146
+ headless: bool=True,
142
147
  max_retries: int | None=None,
143
148
  force: bool=False,
144
149
  recapture_interval: int=300,
@@ -169,6 +174,7 @@ class LacusCore():
169
174
  rendered_hostname_only: bool=True,
170
175
  with_favicon: bool=False,
171
176
  allow_tracking: bool=False,
177
+ headless: bool=True,
172
178
  max_retries: int | None=None,
173
179
  force: bool=False,
174
180
  recapture_interval: int=300,
@@ -201,6 +207,7 @@ class LacusCore():
201
207
  :param rendered_hostname_only: If depth > 0: only capture URLs with the same hostname as the rendered page
202
208
  :param with_favicon: If True, PlaywrightCapture will attempt to get the potential favicons for the rendered URL. It is a dirty trick, see this issue for details: https://github.com/Lookyloo/PlaywrightCapture/issues/45
203
209
  :param allow_tracking: If True, PlaywrightCapture will attempt to click through the cookie banners. It is totally dependent on the framework used on the website.
210
+ :param headless: Whether to run the browser in headless mode. WARNING: requires to run in a graphical environment.
204
211
  :param max_retries: The maximum anount of retries for this capture
205
212
 
206
213
  :param force: Force recapture, even if the same one was already done within the recapture_interval
@@ -221,7 +228,10 @@ class LacusCore():
221
228
  'timezone_id': timezone_id, 'locale': locale,
222
229
  'color_scheme': color_scheme, 'java_script_enabled': java_script_enabled,
223
230
  'viewport': viewport, 'referer': referer, 'with_favicon': with_favicon,
224
- 'allow_tracking': allow_tracking, 'max_retries': max_retries}
231
+ 'allow_tracking': allow_tracking,
232
+ # Quietly force it to true if headed is not allowed.
233
+ 'headless': headless if self.headed_allowed else True,
234
+ 'max_retries': max_retries}
225
235
 
226
236
  try:
227
237
  to_enqueue = CaptureSettings(**settings)
@@ -488,6 +498,7 @@ class LacusCore():
488
498
  proxy=proxy,
489
499
  general_timeout_in_sec=to_capture.general_timeout_in_sec,
490
500
  loglevel=self.master_logger.getEffectiveLevel(),
501
+ headless=to_capture.headless,
491
502
  uuid=uuid) as capture:
492
503
  # required by Mypy: https://github.com/python/mypy/issues/3004
493
504
  capture.headers = to_capture.headers # type: ignore[assignment]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lacuscore
3
- Version: 1.12.9
3
+ Version: 1.12.10
4
4
  Summary: Core of Lacus, usable as a module
5
5
  License: BSD-3-Clause
6
6
  Author: Raphaël Vinot
@@ -27,7 +27,7 @@ Requires-Dist: async-timeout (>=5.0.1) ; python_version < "3.11"
27
27
  Requires-Dist: defang (>=0.5.3)
28
28
  Requires-Dist: dnspython (>=2.7.0)
29
29
  Requires-Dist: eval-type-backport (>=0.2.2) ; python_version < "3.10"
30
- Requires-Dist: playwrightcapture[recaptcha] (>=1.27.7)
30
+ Requires-Dist: playwrightcapture[recaptcha] (>=1.27.8)
31
31
  Requires-Dist: pydantic (>=2.10.6)
32
32
  Requires-Dist: redis[hiredis] (>=5.2.1)
33
33
  Requires-Dist: requests (>=2.32.3)
@@ -0,0 +1,10 @@
1
+ lacuscore/__init__.py,sha256=aLBshQPT9IBDKn5qWrX9A_exqtLFPyLsQiPWdfpAFjA,537
2
+ lacuscore/helpers.py,sha256=GKgy8-kvGJLrOv431AtQRTtMSJ5GNtnwsj-K6WqF0EA,10993
3
+ lacuscore/lacus_monitoring.py,sha256=r6IaYuh6sMq43eOWdZx0fU8p4PWVZlqSD6nr6yOaTUU,2713
4
+ lacuscore/lacuscore.py,sha256=S-qxQJR4WmJHDSAay9tBCWHz2f4uM6z1Elmox7hln54,42049
5
+ lacuscore/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ lacuscore/task_logger.py,sha256=2wDotU6r6vn-aKO8nZNdxSuisSj11LlcxuvW60qPL0Y,1909
7
+ lacuscore-1.12.10.dist-info/LICENSE,sha256=4C4hLYrIkUD96Ggk-y_Go1Qf7PBZrEm9PSeTGe2nd4s,1516
8
+ lacuscore-1.12.10.dist-info/METADATA,sha256=Z2TqBsZDn5K0omvbs0Gv_4TvZBkEAH1RxVO7XfXznl4,2619
9
+ lacuscore-1.12.10.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
10
+ lacuscore-1.12.10.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- lacuscore/__init__.py,sha256=aLBshQPT9IBDKn5qWrX9A_exqtLFPyLsQiPWdfpAFjA,537
2
- lacuscore/helpers.py,sha256=P-OESi6msSqewxp0CqpyJu_fH1lT6rre4FZUK45tUGY,10967
3
- lacuscore/lacus_monitoring.py,sha256=r6IaYuh6sMq43eOWdZx0fU8p4PWVZlqSD6nr6yOaTUU,2713
4
- lacuscore/lacuscore.py,sha256=2MQgfLEi6yUuq-XQeo3XXp5_OaHd4z40g05fKRXR6Qc,41526
5
- lacuscore/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- lacuscore/task_logger.py,sha256=2wDotU6r6vn-aKO8nZNdxSuisSj11LlcxuvW60qPL0Y,1909
7
- lacuscore-1.12.9.dist-info/LICENSE,sha256=4C4hLYrIkUD96Ggk-y_Go1Qf7PBZrEm9PSeTGe2nd4s,1516
8
- lacuscore-1.12.9.dist-info/METADATA,sha256=WWk4cu-rAAU1vfCs-9wV2yF23p0UGTF14KTd4iJ9aTU,2618
9
- lacuscore-1.12.9.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
10
- lacuscore-1.12.9.dist-info/RECORD,,