pylookyloo 1.25.0__tar.gz → 1.26.1__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.

Potentially problematic release.


This version of pylookyloo might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylookyloo
3
- Version: 1.25.0
3
+ Version: 1.26.1
4
4
  Summary: Python CLI and module for Lookyloo
5
5
  Home-page: https://github.com/lookyloo/PyLookyloo
6
6
  License: BSD-3-Clause
@@ -24,7 +24,8 @@ Classifier: Topic :: Internet
24
24
  Classifier: Topic :: Security
25
25
  Provides-Extra: docs
26
26
  Requires-Dist: Sphinx (<7.2) ; (python_version < "3.9") and (extra == "docs")
27
- Requires-Dist: Sphinx (>=7.2,<8.0) ; (python_version >= "3.9") and (extra == "docs")
27
+ Requires-Dist: Sphinx (>=7.2,<8.0) ; (python_version >= "3.9" and python_version < "3.10") and (extra == "docs")
28
+ Requires-Dist: Sphinx (>=8,<9) ; (python_version >= "3.10") and (extra == "docs")
28
29
  Requires-Dist: requests (>=2.32.3,<3.0.0)
29
30
  Project-URL: Documentation, https://pylookyloo.readthedocs.io/en/latest/
30
31
  Project-URL: Repository, https://github.com/lookyloo/PyLookyloo
@@ -42,6 +42,7 @@ class CaptureSettings(TypedDict, total=False):
42
42
  timezone_id: str | None
43
43
  locale: str | None
44
44
  color_scheme: str | None
45
+ java_script_enabled: bool
45
46
  viewport: dict[str, int] | None
46
47
  referer: str | None
47
48
 
@@ -147,6 +148,7 @@ class Lookyloo():
147
148
  timezone_id: str | None=None,
148
149
  locale: str | None=None,
149
150
  color_scheme: str | None=None,
151
+ java_script_enabled: bool=True,
150
152
  viewport: dict[str, int] | None=None,
151
153
  referer: str | None=None,
152
154
  listing: bool | None=None,
@@ -169,6 +171,7 @@ class Lookyloo():
169
171
  timezone_id: str | None=None,
170
172
  locale: str | None=None,
171
173
  color_scheme: str | None=None,
174
+ java_script_enabled: bool | None=None,
172
175
  viewport: dict[str, int] | None=None,
173
176
  referer: str | None=None,
174
177
  listing: bool | None=None,
@@ -195,6 +198,7 @@ class Lookyloo():
195
198
  :param timezone_id: The timezone, warning, it m ust be a valid timezone (continent/city)
196
199
  :param locale: The locale of the browser
197
200
  :param color_scheme: The prefered color scheme of the browser (light or dark)
201
+ :param java_script_enabled: If False, no JS will run during the capture.
198
202
  :param viewport: The viewport of the browser used for capturing
199
203
  :param referer: The referer URL for the capture
200
204
  :param listing: If False, the capture will be not be on the publicly accessible index page of lookyloo
@@ -246,6 +250,8 @@ class Lookyloo():
246
250
  to_send['locale'] = locale
247
251
  if color_scheme:
248
252
  to_send['color_scheme'] = color_scheme
253
+ if java_script_enabled is not None:
254
+ to_send['java_script_enabled'] = java_script_enabled
249
255
  if viewport:
250
256
  to_send['viewport'] = viewport
251
257
  if referer:
@@ -330,6 +336,13 @@ class Lookyloo():
330
336
  r = self.session.post(urljoin(self.root_url, str(PurePosixPath('admin', tree_uuid, 'hide'))))
331
337
  return r.json()
332
338
 
339
+ def remove_capture(self, tree_uuid: str) -> dict[str, str]:
340
+ '''Remove a capture, it will be impossible to get it by UUID (requires an authenticated user, use init_apikey first)'''
341
+ if not self.apikey:
342
+ raise AuthError('You need to initialize the apikey to use this method (see init_apikey)')
343
+ r = self.session.post(urljoin(self.root_url, str(PurePosixPath('admin', tree_uuid, 'remove'))))
344
+ return r.json()
345
+
333
346
  def get_redirects(self, capture_uuid: str) -> dict[str, Any]:
334
347
  '''Returns the initial redirects.
335
348
 
@@ -498,14 +511,26 @@ class Lookyloo():
498
511
  def get_recent_captures(self, timestamp: str | datetime | float | None=None) -> list[str]:
499
512
  '''Gets the uuids of the most recent captures
500
513
 
501
- :param timestamp: Timestamp of the capture
514
+ :param timestamp: Oldest timestamp to consider
502
515
  '''
503
- if not timestamp:
504
- url = urljoin(self.root_url, str(PurePosixPath('json', 'recent_captures')))
505
- else:
516
+ if timestamp:
506
517
  if isinstance(timestamp, datetime):
507
518
  timestamp = timestamp.timestamp()
508
519
  url = urljoin(self.root_url, str(PurePosixPath('json', 'recent_captures', str(timestamp))))
520
+ else:
521
+ url = urljoin(self.root_url, str(PurePosixPath('json', 'recent_captures')))
522
+ r = self.session.get(url)
523
+ return r.json()
524
+
525
+ def get_categories_captures(self, category: str | None=None) -> list[str] | dict[str, list[str]] | None:
526
+ '''Get uuids for a specific category or all categorized uuids if category is None
527
+
528
+ :param category: The category according to which the uuids are to be returned
529
+ '''
530
+ if category:
531
+ url = urljoin(self.root_url, str(PurePosixPath('json', 'categories', category)))
532
+ else:
533
+ url = urljoin(self.root_url, str(PurePosixPath('json', 'categories')))
509
534
  r = self.session.get(url)
510
535
  return r.json()
511
536
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pylookyloo"
3
- version = "1.25.0"
3
+ version = "1.26.1"
4
4
  description = "Python CLI and module for Lookyloo"
5
5
  authors = ["Raphaël Vinot <raphael.vinot@circl.lu>"]
6
6
  license = "BSD-3-Clause"
@@ -34,18 +34,19 @@ python = "^3.8"
34
34
  requests = "^2.32.3"
35
35
  Sphinx = [
36
36
  {version = "<7.2", python = "<3.9", optional = true},
37
- {version = "^7.2", python = ">=3.9", optional = true}
37
+ {version = "^7.2", python = ">=3.9,<3.10", optional = true},
38
+ {version = "^8", python = ">=3.10", optional = true}
38
39
  ]
39
40
 
40
41
  [tool.poetry.group.dev.dependencies]
41
- mypy = "^1.10.1"
42
- types-requests = "^2.32.0.20240622"
42
+ mypy = "^1.11.2"
43
+ types-requests = "^2.32.0.20240914"
43
44
  ipython = [
44
45
  {version = "<8.13.0", python = "<3.9"},
45
46
  {version = "^8.18.0", python = ">=3.9"},
46
47
  {version = "^8.19.0", python = ">=3.10"}
47
48
  ]
48
- pytest = "^8.2.2"
49
+ pytest = "^8.3.3"
49
50
 
50
51
  [tool.poetry.extras]
51
52
  docs = ["Sphinx"]
File without changes
File without changes