pylookyloo 1.26.1__py3-none-any.whl → 1.27.1__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.

Potentially problematic release.


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

pylookyloo/api.py CHANGED
@@ -15,6 +15,9 @@ from pathlib import PurePosixPath, Path
15
15
 
16
16
  import requests
17
17
 
18
+ from urllib3.util import Retry
19
+ from requests.adapters import HTTPAdapter
20
+
18
21
 
19
22
  class PyLookylooError(Exception):
20
23
  pass
@@ -43,6 +46,7 @@ class CaptureSettings(TypedDict, total=False):
43
46
  locale: str | None
44
47
  color_scheme: str | None
45
48
  java_script_enabled: bool
49
+ headless: bool
46
50
  viewport: dict[str, int] | None
47
51
  referer: str | None
48
52
 
@@ -68,6 +72,7 @@ class Lookyloo():
68
72
  :param proxies: The proxies to use to connect to lookyloo (not the ones given to the capture itself) - More details: https://requests.readthedocs.io/en/latest/user/advanced/#proxies
69
73
  '''
70
74
  self.root_url = root_url
75
+ self.apikey: str | None = None
71
76
 
72
77
  if not urlparse(self.root_url).scheme:
73
78
  self.root_url = 'http://' + self.root_url
@@ -77,7 +82,8 @@ class Lookyloo():
77
82
  self.session.headers['user-agent'] = useragent if useragent else f'PyLookyloo / {version("pylookyloo")}'
78
83
  if proxies:
79
84
  self.session.proxies.update(proxies)
80
- self.apikey: str | None = None
85
+ retries = Retry(total=5, backoff_factor=0.1, status_forcelist=[500, 502, 503, 504])
86
+ self.session.mount('http://', HTTPAdapter(max_retries=retries))
81
87
 
82
88
  @property
83
89
  def is_up(self) -> bool:
@@ -149,6 +155,7 @@ class Lookyloo():
149
155
  locale: str | None=None,
150
156
  color_scheme: str | None=None,
151
157
  java_script_enabled: bool=True,
158
+ headless: bool=True,
152
159
  viewport: dict[str, int] | None=None,
153
160
  referer: str | None=None,
154
161
  listing: bool | None=None,
@@ -172,6 +179,7 @@ class Lookyloo():
172
179
  locale: str | None=None,
173
180
  color_scheme: str | None=None,
174
181
  java_script_enabled: bool | None=None,
182
+ headless: bool=True,
175
183
  viewport: dict[str, int] | None=None,
176
184
  referer: str | None=None,
177
185
  listing: bool | None=None,
@@ -199,6 +207,7 @@ class Lookyloo():
199
207
  :param locale: The locale of the browser
200
208
  :param color_scheme: The prefered color scheme of the browser (light or dark)
201
209
  :param java_script_enabled: If False, no JS will run during the capture.
210
+ :param headless: If False, the browser will be headed, it requires the capture to be done on a desktop.
202
211
  :param viewport: The viewport of the browser used for capturing
203
212
  :param referer: The referer URL for the capture
204
213
  :param listing: If False, the capture will be not be on the publicly accessible index page of lookyloo
@@ -252,6 +261,8 @@ class Lookyloo():
252
261
  to_send['color_scheme'] = color_scheme
253
262
  if java_script_enabled is not None:
254
263
  to_send['java_script_enabled'] = java_script_enabled
264
+ if headless is not None:
265
+ to_send['headless'] = headless
255
266
  if viewport:
256
267
  to_send['viewport'] = viewport
257
268
  if referer:
@@ -534,6 +545,14 @@ class Lookyloo():
534
545
  r = self.session.get(url)
535
546
  return r.json()
536
547
 
548
+ def push_from_lacus(self, capture: dict[str, Any]) -> dict[str, Any]:
549
+ '''Push a capture from Lacus to Lookyloo
550
+
551
+ :param capture: The capture to push from Lacus
552
+ '''
553
+ r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', 'upload'))), json=capture)
554
+ return r.json()
555
+
537
556
  @overload
538
557
  def upload_capture(self, *, quiet: Literal[True],
539
558
  listing: bool = False,
@@ -1,12 +1,11 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: pylookyloo
3
- Version: 1.26.1
3
+ Version: 1.27.1
4
4
  Summary: Python CLI and module for Lookyloo
5
- Home-page: https://github.com/lookyloo/PyLookyloo
6
5
  License: BSD-3-Clause
7
6
  Author: Raphaël Vinot
8
7
  Author-email: raphael.vinot@circl.lu
9
- Requires-Python: >=3.8,<4.0
8
+ Requires-Python: >=3.9
10
9
  Classifier: Development Status :: 5 - Production/Stable
11
10
  Classifier: Environment :: Console
12
11
  Classifier: Intended Audience :: Information Technology
@@ -15,20 +14,21 @@ Classifier: Intended Audience :: Telecommunications Industry
15
14
  Classifier: License :: OSI Approved :: BSD License
16
15
  Classifier: Operating System :: POSIX :: Linux
17
16
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.8
19
17
  Classifier: Programming Language :: Python :: 3.9
20
18
  Classifier: Programming Language :: Python :: 3.10
21
19
  Classifier: Programming Language :: Python :: 3.11
22
20
  Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
23
22
  Classifier: Topic :: Internet
24
23
  Classifier: Topic :: Security
25
24
  Provides-Extra: docs
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 python_version < "3.10") and (extra == "docs")
28
- Requires-Dist: Sphinx (>=8,<9) ; (python_version >= "3.10") and (extra == "docs")
29
- Requires-Dist: requests (>=2.32.3,<3.0.0)
25
+ Provides-Extra: examples
26
+ Requires-Dist: Sphinx (>=8.1.3) ; (python_version >= "3.10") and (extra == "docs")
27
+ Requires-Dist: pylacus (>=1.12.1) ; extra == "examples"
28
+ Requires-Dist: requests (>=2.32.3)
30
29
  Project-URL: Documentation, https://pylookyloo.readthedocs.io/en/latest/
31
30
  Project-URL: Repository, https://github.com/lookyloo/PyLookyloo
31
+ Project-URL: issues, https://github.com/lookyloo/PyLookyloo/issues
32
32
  Description-Content-Type: text/markdown
33
33
 
34
34
  [![Documentation Status](https://readthedocs.org/projects/pylookyloo/badge/?version=latest)](https://pylookyloo.readthedocs.io/en/latest/?badge=latest)
@@ -0,0 +1,8 @@
1
+ pylookyloo/__init__.py,sha256=_JYXwXHL7ShZkeruvGd8qDTpxNRfuDjvV65SOMMU6yc,1922
2
+ pylookyloo/api.py,sha256=JrHJr4IJ8NpJI8otMS83f4uUTifFOxqwDO2UIFNW2QE,29530
3
+ pylookyloo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ pylookyloo-1.27.1.dist-info/LICENSE,sha256=4C4hLYrIkUD96Ggk-y_Go1Qf7PBZrEm9PSeTGe2nd4s,1516
5
+ pylookyloo-1.27.1.dist-info/METADATA,sha256=6AwRog0u2bcT5lAcIOT7Y_OxZe-4g8RFOpegYiT9XVE,2347
6
+ pylookyloo-1.27.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
7
+ pylookyloo-1.27.1.dist-info/entry_points.txt,sha256=y2c0Ujg8co6Xyf7MoxStVU-fLQMZBSGAg-KFidmsha4,44
8
+ pylookyloo-1.27.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: poetry-core 2.0.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=2U7ExW9Cr7dJUOXXop_UIULR4Zru4SogC2Cu_wJ6OcM,28683
3
- pylookyloo/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- pylookyloo-1.26.1.dist-info/LICENSE,sha256=4C4hLYrIkUD96Ggk-y_Go1Qf7PBZrEm9PSeTGe2nd4s,1516
5
- pylookyloo-1.26.1.dist-info/METADATA,sha256=NwfOYpAMGHvhLk1kQzntIwKqR07HNrER1-0_SXzmGhY,2450
6
- pylookyloo-1.26.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
7
- pylookyloo-1.26.1.dist-info/entry_points.txt,sha256=y2c0Ujg8co6Xyf7MoxStVU-fLQMZBSGAg-KFidmsha4,44
8
- pylookyloo-1.26.1.dist-info/RECORD,,