lacuscore 1.16.3__tar.gz → 1.16.5__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.3
2
2
  Name: lacuscore
3
- Version: 1.16.3
3
+ Version: 1.16.5
4
4
  Summary: Core of Lacus, usable as a module
5
5
  License: BSD-3-Clause
6
6
  Author: Raphaël Vinot
@@ -26,7 +26,7 @@ Requires-Dist: async-timeout (>=5.0.1) ; python_version < "3.11"
26
26
  Requires-Dist: defang (>=0.5.3)
27
27
  Requires-Dist: dnspython (>=2.7.0)
28
28
  Requires-Dist: eval-type-backport (>=0.2.2) ; python_version < "3.10"
29
- Requires-Dist: playwrightcapture[recaptcha] (>=1.31.4)
29
+ Requires-Dist: playwrightcapture[recaptcha] (>=1.31.6)
30
30
  Requires-Dist: pydantic (>=2.11.7)
31
31
  Requires-Dist: redis[hiredis] (>=5.3.0,<6.0.0)
32
32
  Requires-Dist: requests (>=2.32.4)
@@ -19,8 +19,23 @@ from playwrightcapture.capture import CaptureResponse as PlaywrightCaptureRespon
19
19
 
20
20
 
21
21
  if sys.version_info < (3, 12):
22
+ # This bit is required as long as we need to support python < 3.12, stop removing it, you idiot
23
+ # That's the runtime failure: https://github.com/ail-project/lacus/actions/runs/16447900822/job/46484807036
24
+ # And the MyPy failure: https://github.com/ail-project/LacusCore/actions/runs/16447753492/job/46484287947
22
25
  from typing_extensions import TypedDict
23
26
 
27
+ class SetCookieParam(TypedDict, total=False):
28
+ name: str
29
+ value: str
30
+ url: str
31
+ domain: str
32
+ path: str
33
+ expires: float
34
+ httpOnly: bool
35
+ secure: bool
36
+ sameSite: Literal["Lax", "None", "Strict"]
37
+ partitionKey: str
38
+
24
39
  class Cookie(TypedDict, total=False):
25
40
  name: str
26
41
  value: str
@@ -30,9 +45,10 @@ if sys.version_info < (3, 12):
30
45
  httpOnly: bool
31
46
  secure: bool
32
47
  sameSite: Literal["Lax", "None", "Strict"]
48
+ partitionKey: str
33
49
  else:
34
50
  from typing import TypedDict
35
- from playwright._impl._api_structures import Cookie # , StorageState
51
+ from playwright._impl._api_structures import SetCookieParam, Cookie # , StorageState
36
52
 
37
53
 
38
54
  class LacusCoreException(Exception):
@@ -116,7 +132,7 @@ class CaptureSettings(BaseModel):
116
132
  proxy: str | dict[str, str] | None = None
117
133
  socks5_dns_resolver: str | list[str] | None = None
118
134
  general_timeout_in_sec: int | None = None
119
- cookies: list[Cookie] | None = None
135
+ cookies: list[SetCookieParam] | None = None
120
136
  # NOTE: should be that, but StorageState doesn't define the indexeddb
121
137
  # storage: StorageState | None = None
122
138
  storage: dict[str, Any] | None = None
@@ -251,8 +267,8 @@ class CaptureSettings(BaseModel):
251
267
  try:
252
268
  cookies = json.loads(cookies)
253
269
  except json.JSONDecodeError as e:
254
- print(e)
255
270
  # Cookies are invalid, ignoring.
271
+ print(f'Broken cookie: {e}')
256
272
  return None
257
273
  if isinstance(cookies, dict):
258
274
  # might be a single cookie in the format name: value, make it a list
@@ -55,8 +55,10 @@ else:
55
55
  if timeout_cm.expired():
56
56
  logger.warning(f'Timeout expired: {error_message}')
57
57
 
58
- if TYPE_CHECKING:
59
- from playwright._impl._api_structures import Cookie
58
+ if sys.version_info < (3, 12):
59
+ from .helpers import SetCookieParam, Cookie
60
+ else:
61
+ from playwright._impl._api_structures import SetCookieParam, Cookie
60
62
 
61
63
 
62
64
  BROWSER = Literal['chromium', 'firefox', 'webkit']
@@ -503,7 +505,7 @@ class LacusCore():
503
505
  else:
504
506
  browser_engine = 'webkit'
505
507
 
506
- cookies: list[Cookie] = []
508
+ cookies: list[SetCookieParam] = []
507
509
  if to_capture.cookies:
508
510
  # In order to properly pass the cookies to playwright,
509
511
  # each of then must have a name, a value and either a domain + path or a URL
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lacuscore"
3
- version = "1.16.3"
3
+ version = "1.16.5"
4
4
  description = "Core of Lacus, usable as a module"
5
5
  authors = [
6
6
  {name="Raphaël Vinot", email="raphael.vinot@circl.lu"}
@@ -15,7 +15,7 @@ dynamic = [ "classifiers" ]
15
15
 
16
16
  dependencies = [
17
17
  "requests (>=2.32.4)",
18
- "playwrightcapture[recaptcha] (>=1.31.4)",
18
+ "playwrightcapture[recaptcha] (>=1.31.6)",
19
19
  "defang (>=0.5.3)",
20
20
  "ua-parser[regex] (>=1.0.1)",
21
21
  "redis[hiredis] (>=5.3.0,<6.0.0)",
File without changes
File without changes