lacuscore 1.9.5__tar.gz → 1.9.6__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.
- {lacuscore-1.9.5 → lacuscore-1.9.6}/PKG-INFO +2 -2
- {lacuscore-1.9.5 → lacuscore-1.9.6}/lacuscore/lacuscore.py +23 -2
- {lacuscore-1.9.5 → lacuscore-1.9.6}/pyproject.toml +4 -4
- {lacuscore-1.9.5 → lacuscore-1.9.6}/LICENSE +0 -0
- {lacuscore-1.9.5 → lacuscore-1.9.6}/README.md +0 -0
- {lacuscore-1.9.5 → lacuscore-1.9.6}/lacuscore/__init__.py +0 -0
- {lacuscore-1.9.5 → lacuscore-1.9.6}/lacuscore/helpers.py +0 -0
- {lacuscore-1.9.5 → lacuscore-1.9.6}/lacuscore/lacus_monitoring.py +0 -0
- {lacuscore-1.9.5 → lacuscore-1.9.6}/lacuscore/py.typed +0 -0
- {lacuscore-1.9.5 → lacuscore-1.9.6}/lacuscore/task_logger.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: lacuscore
|
3
|
-
Version: 1.9.
|
3
|
+
Version: 1.9.6
|
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
|
@@ -29,7 +29,7 @@ Requires-Dist: async-timeout (>=4.0.3,<5.0.0) ; python_version < "3.11"
|
|
29
29
|
Requires-Dist: defang (>=0.5.3,<0.6.0)
|
30
30
|
Requires-Dist: dnspython (>=2.6.1,<3.0.0)
|
31
31
|
Requires-Dist: playwrightcapture[recaptcha] (>=1.24.11,<2.0.0)
|
32
|
-
Requires-Dist: redis[hiredis] (>=5.0.
|
32
|
+
Requires-Dist: redis[hiredis] (>=5.0.6,<6.0.0)
|
33
33
|
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
34
34
|
Requires-Dist: ua-parser (>=0.18.0,<0.19.0)
|
35
35
|
Project-URL: Documentation, https://lacuscore.readthedocs.io/en/latest/
|
@@ -531,6 +531,27 @@ class LacusCore():
|
|
531
531
|
browser_engine = 'firefox'
|
532
532
|
else:
|
533
533
|
browser_engine = 'webkit'
|
534
|
+
|
535
|
+
cookies: list[dict[str, Any]] = []
|
536
|
+
if to_capture.get('cookies') and to_capture['cookies'] is not None:
|
537
|
+
# In order to properly pass the cookies to playwright,
|
538
|
+
# each of then must have a name, a value and either a domain + path or a URL
|
539
|
+
# Name and value are mandatory, and we cannot auto-fill them.
|
540
|
+
# If the cookie doesn't have a domain + path OR a URL, we fill the domain
|
541
|
+
# with the hostname of the URL we try to capture and the path with "/"
|
542
|
+
for cookie in to_capture['cookies']:
|
543
|
+
if len(cookie) == 1:
|
544
|
+
# we have a cookie in the format key: value
|
545
|
+
name, value = cookie.popitem()
|
546
|
+
cookie = {'name': name, 'value': value}
|
547
|
+
if 'name' not in cookie or 'value' not in cookie:
|
548
|
+
logger.warning(f'Invalid cookie: {cookie}')
|
549
|
+
continue
|
550
|
+
if 'domain' not in cookie and 'url' not in cookie:
|
551
|
+
cookie['domain'] = splitted_url.hostname
|
552
|
+
cookie['path'] = '/'
|
553
|
+
cookies.append(cookie)
|
554
|
+
|
534
555
|
try:
|
535
556
|
logger.debug(f'Capturing {url}')
|
536
557
|
stats_pipeline.sadd(f'stats:{today}:captures', url)
|
@@ -543,7 +564,7 @@ class LacusCore():
|
|
543
564
|
uuid=uuid) as capture:
|
544
565
|
# required by Mypy: https://github.com/python/mypy/issues/3004
|
545
566
|
capture.headers = to_capture.get('headers') # type: ignore[assignment]
|
546
|
-
capture.cookies =
|
567
|
+
capture.cookies = cookies # type: ignore[assignment]
|
547
568
|
capture.viewport = to_capture.get('viewport') # type: ignore[assignment]
|
548
569
|
capture.user_agent = to_capture.get('user_agent') # type: ignore[assignment]
|
549
570
|
capture.http_credentials = to_capture.get('http_credentials') # type: ignore[assignment]
|
@@ -583,7 +604,7 @@ class LacusCore():
|
|
583
604
|
except RetryCapture as e:
|
584
605
|
raise e
|
585
606
|
except PlaywrightCaptureException as e:
|
586
|
-
logger.
|
607
|
+
logger.warning(f'Invalid parameters for the capture of {url} - {e}')
|
587
608
|
result = {'error': f'Invalid parameters for the capture of {url} - {e}'}
|
588
609
|
raise CaptureError(f'Invalid parameters for the capture of {url} - {e}')
|
589
610
|
except asyncio.CancelledError:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "lacuscore"
|
3
|
-
version = "1.9.
|
3
|
+
version = "1.9.6"
|
4
4
|
description = "Core of Lacus, usable as a module"
|
5
5
|
authors = ["Raphaël Vinot <raphael.vinot@circl.lu>"]
|
6
6
|
license = "BSD-3-Clause"
|
@@ -37,7 +37,7 @@ Sphinx = [
|
|
37
37
|
playwrightcapture = {extras = ["recaptcha"], version = "^1.24.11"}
|
38
38
|
defang = "^0.5.3"
|
39
39
|
ua-parser = "^0.18.0"
|
40
|
-
redis = {version = "^5.0.
|
40
|
+
redis = {version = "^5.0.6", extras = ["hiredis"]}
|
41
41
|
dnspython = "^2.6.1"
|
42
42
|
async-timeout = {version = "^4.0.3", python = "<3.11"}
|
43
43
|
|
@@ -47,14 +47,14 @@ docs = ["Sphinx"]
|
|
47
47
|
[tool.poetry.group.dev.dependencies]
|
48
48
|
types-redis = {version = "^4.6.0.20240425"}
|
49
49
|
mypy = "^1.10.0"
|
50
|
-
types-requests = "^2.32.0.
|
50
|
+
types-requests = "^2.32.0.20240602"
|
51
51
|
types-beautifulsoup4 = "^4.12.0.20240511"
|
52
52
|
ipython = [
|
53
53
|
{version = "<8.13.0", python = "<3.9"},
|
54
54
|
{version = "^8.18.0", python = ">=3.9"},
|
55
55
|
{version = "^8.19.0", python = ">=3.10"}
|
56
56
|
]
|
57
|
-
pytest = "^8.2.
|
57
|
+
pytest = "^8.2.2"
|
58
58
|
|
59
59
|
[build-system]
|
60
60
|
requires = ["poetry_core"]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|