pylookyloo 1.36.1__tar.gz → 1.36.3__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.4
2
2
  Name: pylookyloo
3
- Version: 1.36.1
3
+ Version: 1.36.3
4
4
  Summary: Python CLI and module for Lookyloo
5
5
  License-Expression: GPL-2.0-or-later
6
6
  License-File: LICENSE
@@ -24,7 +24,7 @@ Classifier: Topic :: Security
24
24
  Provides-Extra: docs
25
25
  Provides-Extra: examples
26
26
  Requires-Dist: Sphinx (>=9.1.0) ; (python_version >= "3.12") and (extra == "docs")
27
- Requires-Dist: pylacus (>=1.21.0) ; extra == "examples"
27
+ Requires-Dist: pylacus (>=1.21.2) ; extra == "examples"
28
28
  Requires-Dist: requests (>=2.32.5)
29
29
  Project-URL: Documentation, https://pylookyloo.readthedocs.io/en/latest/
30
30
  Project-URL: Repository, https://github.com/lookyloo/PyLookyloo
@@ -678,7 +678,8 @@ class Lookyloo():
678
678
  har: Path | BytesIO | str | None = None,
679
679
  html: Path | BytesIO | str | None = None,
680
680
  last_redirected_url: str | None = None,
681
- screenshot: Path | BytesIO | str | None = None) -> str:
681
+ screenshot: Path | BytesIO | str | None = None,
682
+ categories: list[str] | None=None) -> str:
682
683
  ...
683
684
 
684
685
  @overload
@@ -688,7 +689,8 @@ class Lookyloo():
688
689
  har: Path | BytesIO | str | None = None,
689
690
  html: Path | BytesIO | str | None = None,
690
691
  last_redirected_url: str | None = None,
691
- 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]]:
692
694
  ...
693
695
 
694
696
  def upload_capture(self, *, quiet: bool = False,
@@ -697,7 +699,8 @@ class Lookyloo():
697
699
  har: Path | BytesIO | str | None = None,
698
700
  html: Path | BytesIO | str | None = None,
699
701
  last_redirected_url: str | None = None,
700
- 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]]:
701
704
  '''Upload a capture via har-file and others
702
705
 
703
706
  :param quiet: Returns the UUID only, instead of the the UUID and the potential error / warning messages
@@ -707,6 +710,7 @@ class Lookyloo():
707
710
  :param html: rendered HTML of the capture
708
711
  :param last_redirected_url: The landing page of the capture
709
712
  :param screenshot: Screenshot of the capture
713
+ :param categories: The categories assigned to the capture
710
714
  '''
711
715
  def encode_document(document: Path | BytesIO | str) -> str:
712
716
  if isinstance(document, str):
@@ -719,6 +723,8 @@ class Lookyloo():
719
723
  return base64.b64encode(document.getvalue()).decode()
720
724
 
721
725
  to_send: dict[str, Any] = {'listing': listing}
726
+ if categories:
727
+ to_send['categories'] = categories
722
728
 
723
729
  if full_capture:
724
730
  b64_full_capture = encode_document(full_capture)
@@ -740,9 +746,16 @@ class Lookyloo():
740
746
  else:
741
747
  raise PyLookylooError("Full capture or at least har-file are required")
742
748
 
743
- r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', 'upload'))), json=to_send)
744
- r.raise_for_status()
745
- json_response = r.json()
749
+ try:
750
+ r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', 'upload'))), json=to_send)
751
+ json_response = r.json()
752
+ r.raise_for_status()
753
+ except requests.exceptions.HTTPError:
754
+ # We should have a response with details
755
+ raise PyLookylooError(f'Unable to upload capture: {json_response}.')
756
+ except Exception as e:
757
+ raise PyLookylooError(f'Unable to upload capture: {e}.')
758
+
746
759
  uuid = json_response['uuid']
747
760
  messages = json_response['messages']
748
761
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pylookyloo"
3
- version = "1.36.1"
3
+ version = "1.36.3"
4
4
  description = "Python CLI and module for Lookyloo"
5
5
  authors = [
6
6
  {name="Raphaël Vinot", email="raphael.vinot@circl.lu"}
@@ -37,7 +37,7 @@ lookyloo = 'pylookyloo:main'
37
37
 
38
38
  [project.optional-dependencies]
39
39
  docs = ["Sphinx (>=9.1.0) ; python_version >= \"3.12\""]
40
- examples = ["pylacus (>=1.21.0)"]
40
+ examples = ["pylacus (>=1.21.2)"]
41
41
 
42
42
  [tool.poetry.group.dev.dependencies]
43
43
  mypy = "^1.19.1"
File without changes
File without changes