pylookyloo 1.33.0__py3-none-any.whl → 1.36.2__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.
pylookyloo/api.py CHANGED
@@ -76,6 +76,7 @@ class CaptureSettings(TypedDict, total=False):
76
76
  headless: bool
77
77
  viewport: dict[str, int] | None
78
78
  referer: str | None
79
+ categories: list[str] | None
79
80
 
80
81
  listing: bool | None
81
82
  auto_report: bool | dict[str, str] | None
@@ -195,7 +196,8 @@ class Lookyloo():
195
196
  viewport: dict[str, int] | None=None,
196
197
  referer: str | None=None,
197
198
  listing: bool | None=None,
198
- auto_report: bool | dict[str, str] | None=None
199
+ auto_report: bool | dict[str, str] | None=None,
200
+ categories: list[str] | None=None
199
201
  ) -> str:
200
202
  ...
201
203
 
@@ -222,7 +224,8 @@ class Lookyloo():
222
224
  viewport: dict[str, int] | None=None,
223
225
  referer: str | None=None,
224
226
  listing: bool | None=None,
225
- auto_report: bool | dict[str, str] | None=None
227
+ auto_report: bool | dict[str, str] | None=None,
228
+ categories: list[str] | None=None
226
229
  ) -> str:
227
230
  '''Submit a URL to a lookyloo instance.
228
231
 
@@ -256,6 +259,7 @@ class Lookyloo():
256
259
  Pass True if you want to autoreport without any setting, or a dictionary with two keys:
257
260
  * email (required): the email of the submitter, so the analyst to get in touch
258
261
  * comment (optional): a comment about the capture to help the analyst
262
+ :param categories: (v1.37.0+) A list of categories to assign to the capture
259
263
  '''
260
264
  to_send: CaptureSettings
261
265
  if capture_settings:
@@ -316,6 +320,8 @@ class Lookyloo():
316
320
  to_send['listing'] = listing
317
321
  if auto_report:
318
322
  to_send['auto_report'] = auto_report
323
+ if categories:
324
+ to_send['categories'] = categories
319
325
 
320
326
  response = self.session.post(urljoin(self.root_url, 'submit'), json=to_send)
321
327
  response.raise_for_status()
@@ -672,7 +678,8 @@ class Lookyloo():
672
678
  har: Path | BytesIO | str | None = None,
673
679
  html: Path | BytesIO | str | None = None,
674
680
  last_redirected_url: str | None = None,
675
- screenshot: Path | BytesIO | str | None = None) -> str:
681
+ screenshot: Path | BytesIO | str | None = None,
682
+ categories: list[str] | None=None) -> str:
676
683
  ...
677
684
 
678
685
  @overload
@@ -682,7 +689,8 @@ class Lookyloo():
682
689
  har: Path | BytesIO | str | None = None,
683
690
  html: Path | BytesIO | str | None = None,
684
691
  last_redirected_url: str | None = None,
685
- screenshot: Path | BytesIO | str | None = None) -> tuple[str, dict[str, str]]:
692
+ screenshot: Path | BytesIO | str | None = None,
693
+ categories: list[str] | None=None) -> tuple[str, dict[str, str]]:
686
694
  ...
687
695
 
688
696
  def upload_capture(self, *, quiet: bool = False,
@@ -691,7 +699,8 @@ class Lookyloo():
691
699
  har: Path | BytesIO | str | None = None,
692
700
  html: Path | BytesIO | str | None = None,
693
701
  last_redirected_url: str | None = None,
694
- screenshot: Path | BytesIO | str | None = None) -> str | tuple[str, dict[str, str]]:
702
+ screenshot: Path | BytesIO | str | None = None,
703
+ categories: list[str] | None=None) -> str | tuple[str, dict[str, str]]:
695
704
  '''Upload a capture via har-file and others
696
705
 
697
706
  :param quiet: Returns the UUID only, instead of the the UUID and the potential error / warning messages
@@ -701,6 +710,7 @@ class Lookyloo():
701
710
  :param html: rendered HTML of the capture
702
711
  :param last_redirected_url: The landing page of the capture
703
712
  :param screenshot: Screenshot of the capture
713
+ :param categories: The categories assigned to the capture
704
714
  '''
705
715
  def encode_document(document: Path | BytesIO | str) -> str:
706
716
  if isinstance(document, str):
@@ -713,6 +723,8 @@ class Lookyloo():
713
723
  return base64.b64encode(document.getvalue()).decode()
714
724
 
715
725
  to_send: dict[str, Any] = {'listing': listing}
726
+ if categories:
727
+ to_send['categories'] = categories
716
728
 
717
729
  if full_capture:
718
730
  b64_full_capture = encode_document(full_capture)
@@ -734,9 +746,13 @@ class Lookyloo():
734
746
  else:
735
747
  raise PyLookylooError("Full capture or at least har-file are required")
736
748
 
737
- r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', 'upload'))), json=to_send)
738
- r.raise_for_status()
739
- json_response = r.json()
749
+ try:
750
+ r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', 'upload'))), json=to_send)
751
+ r.raise_for_status()
752
+ json_response = r.json()
753
+ except Exception as e:
754
+ raise PyLookylooError(f'Unable to upload capture: {e}.')
755
+
740
756
  uuid = json_response['uuid']
741
757
  messages = json_response['messages']
742
758
 
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pylookyloo
3
- Version: 1.33.0
3
+ Version: 1.36.2
4
4
  Summary: Python CLI and module for Lookyloo
5
5
  License-Expression: GPL-2.0-or-later
6
6
  License-File: LICENSE
7
7
  Author: Raphaël Vinot
8
8
  Author-email: raphael.vinot@circl.lu
9
- Requires-Python: >=3.9
9
+ Requires-Python: >=3.10
10
10
  Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Environment :: Console
12
12
  Classifier: Intended Audience :: Information Technology
@@ -14,7 +14,6 @@ Classifier: Intended Audience :: Science/Research
14
14
  Classifier: Intended Audience :: Telecommunications Industry
15
15
  Classifier: Operating System :: POSIX :: Linux
16
16
  Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.9
18
17
  Classifier: Programming Language :: Python :: 3.10
19
18
  Classifier: Programming Language :: Python :: 3.11
20
19
  Classifier: Programming Language :: Python :: 3.12
@@ -24,8 +23,8 @@ Classifier: Topic :: Internet
24
23
  Classifier: Topic :: Security
25
24
  Provides-Extra: docs
26
25
  Provides-Extra: examples
27
- Requires-Dist: Sphinx (>=8.2.3) ; (python_version >= "3.11") and (extra == "docs")
28
- Requires-Dist: pylacus (>=1.18.0) ; extra == "examples"
26
+ Requires-Dist: Sphinx (>=9.1.0) ; (python_version >= "3.12") and (extra == "docs")
27
+ Requires-Dist: pylacus (>=1.21.0) ; extra == "examples"
29
28
  Requires-Dist: requests (>=2.32.5)
30
29
  Project-URL: Documentation, https://pylookyloo.readthedocs.io/en/latest/
31
30
  Project-URL: Repository, https://github.com/lookyloo/PyLookyloo
@@ -0,0 +1,8 @@
1
+ pylookyloo/__init__.py,sha256=_JYXwXHL7ShZkeruvGd8qDTpxNRfuDjvV65SOMMU6yc,1922
2
+ pylookyloo/api.py,sha256=9NFPMcr1WAlesY0dWJSRx8-Nug1OErrYTLp8IZynDLU,37047
3
+ pylookyloo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ pylookyloo-1.36.2.dist-info/METADATA,sha256=9xHsTcp6S2yyQf7bgFs-w21JG68GQvHy3v4eMzho0s4,2335
5
+ pylookyloo-1.36.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
6
+ pylookyloo-1.36.2.dist-info/entry_points.txt,sha256=y2c0Ujg8co6Xyf7MoxStVU-fLQMZBSGAg-KFidmsha4,44
7
+ pylookyloo-1.36.2.dist-info/licenses/LICENSE,sha256=4C4hLYrIkUD96Ggk-y_Go1Qf7PBZrEm9PSeTGe2nd4s,1516
8
+ pylookyloo-1.36.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.2.0
2
+ Generator: poetry-core 2.2.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,8 +0,0 @@
1
- pylookyloo/__init__.py,sha256=_JYXwXHL7ShZkeruvGd8qDTpxNRfuDjvV65SOMMU6yc,1922
2
- pylookyloo/api.py,sha256=ehPOX_BWePTRWQu5cAW6Du7y-FY0ViGYMPjFOiN3CvA,36316
3
- pylookyloo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- pylookyloo-1.33.0.dist-info/METADATA,sha256=a1tQ0SFfe22VC0E9dPPqnqFdI9QH5B9rAitYuHssnCk,2384
5
- pylookyloo-1.33.0.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
6
- pylookyloo-1.33.0.dist-info/entry_points.txt,sha256=y2c0Ujg8co6Xyf7MoxStVU-fLQMZBSGAg-KFidmsha4,44
7
- pylookyloo-1.33.0.dist-info/licenses/LICENSE,sha256=4C4hLYrIkUD96Ggk-y_Go1Qf7PBZrEm9PSeTGe2nd4s,1516
8
- pylookyloo-1.33.0.dist-info/RECORD,,