pylookyloo 1.25.0__tar.gz → 1.27.0__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,12 +1,11 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: pylookyloo
3
- Version: 1.25.0
3
+ Version: 1.27.0
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,19 +14,19 @@ 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 (extra == "docs")
28
- Requires-Dist: requests (>=2.32.3,<3.0.0)
25
+ Requires-Dist: Sphinx (>=8.1.3) ; (python_version >= "3.10") and (extra == "docs")
26
+ Requires-Dist: requests (>=2.32.3)
29
27
  Project-URL: Documentation, https://pylookyloo.readthedocs.io/en/latest/
30
28
  Project-URL: Repository, https://github.com/lookyloo/PyLookyloo
29
+ Project-URL: issues, https://github.com/lookyloo/PyLookyloo/issues
31
30
  Description-Content-Type: text/markdown
32
31
 
33
32
  [![Documentation Status](https://readthedocs.org/projects/pylookyloo/badge/?version=latest)](https://pylookyloo.readthedocs.io/en/latest/?badge=latest)
@@ -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
@@ -42,6 +45,7 @@ class CaptureSettings(TypedDict, total=False):
42
45
  timezone_id: str | None
43
46
  locale: str | None
44
47
  color_scheme: str | None
48
+ java_script_enabled: bool
45
49
  viewport: dict[str, int] | None
46
50
  referer: str | None
47
51
 
@@ -67,6 +71,7 @@ class Lookyloo():
67
71
  :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
68
72
  '''
69
73
  self.root_url = root_url
74
+ self.apikey: str | None = None
70
75
 
71
76
  if not urlparse(self.root_url).scheme:
72
77
  self.root_url = 'http://' + self.root_url
@@ -76,7 +81,8 @@ class Lookyloo():
76
81
  self.session.headers['user-agent'] = useragent if useragent else f'PyLookyloo / {version("pylookyloo")}'
77
82
  if proxies:
78
83
  self.session.proxies.update(proxies)
79
- self.apikey: str | None = None
84
+ retries = Retry(total=5, backoff_factor=0.1, status_forcelist=[500, 502, 503, 504])
85
+ self.session.mount('http://', HTTPAdapter(max_retries=retries))
80
86
 
81
87
  @property
82
88
  def is_up(self) -> bool:
@@ -147,6 +153,7 @@ class Lookyloo():
147
153
  timezone_id: str | None=None,
148
154
  locale: str | None=None,
149
155
  color_scheme: str | None=None,
156
+ java_script_enabled: bool=True,
150
157
  viewport: dict[str, int] | None=None,
151
158
  referer: str | None=None,
152
159
  listing: bool | None=None,
@@ -169,6 +176,7 @@ class Lookyloo():
169
176
  timezone_id: str | None=None,
170
177
  locale: str | None=None,
171
178
  color_scheme: str | None=None,
179
+ java_script_enabled: bool | None=None,
172
180
  viewport: dict[str, int] | None=None,
173
181
  referer: str | None=None,
174
182
  listing: bool | None=None,
@@ -195,6 +203,7 @@ class Lookyloo():
195
203
  :param timezone_id: The timezone, warning, it m ust be a valid timezone (continent/city)
196
204
  :param locale: The locale of the browser
197
205
  :param color_scheme: The prefered color scheme of the browser (light or dark)
206
+ :param java_script_enabled: If False, no JS will run during the capture.
198
207
  :param viewport: The viewport of the browser used for capturing
199
208
  :param referer: The referer URL for the capture
200
209
  :param listing: If False, the capture will be not be on the publicly accessible index page of lookyloo
@@ -246,6 +255,8 @@ class Lookyloo():
246
255
  to_send['locale'] = locale
247
256
  if color_scheme:
248
257
  to_send['color_scheme'] = color_scheme
258
+ if java_script_enabled is not None:
259
+ to_send['java_script_enabled'] = java_script_enabled
249
260
  if viewport:
250
261
  to_send['viewport'] = viewport
251
262
  if referer:
@@ -330,6 +341,13 @@ class Lookyloo():
330
341
  r = self.session.post(urljoin(self.root_url, str(PurePosixPath('admin', tree_uuid, 'hide'))))
331
342
  return r.json()
332
343
 
344
+ def remove_capture(self, tree_uuid: str) -> dict[str, str]:
345
+ '''Remove a capture, it will be impossible to get it by UUID (requires an authenticated user, use init_apikey first)'''
346
+ if not self.apikey:
347
+ raise AuthError('You need to initialize the apikey to use this method (see init_apikey)')
348
+ r = self.session.post(urljoin(self.root_url, str(PurePosixPath('admin', tree_uuid, 'remove'))))
349
+ return r.json()
350
+
333
351
  def get_redirects(self, capture_uuid: str) -> dict[str, Any]:
334
352
  '''Returns the initial redirects.
335
353
 
@@ -498,14 +516,26 @@ class Lookyloo():
498
516
  def get_recent_captures(self, timestamp: str | datetime | float | None=None) -> list[str]:
499
517
  '''Gets the uuids of the most recent captures
500
518
 
501
- :param timestamp: Timestamp of the capture
519
+ :param timestamp: Oldest timestamp to consider
502
520
  '''
503
- if not timestamp:
504
- url = urljoin(self.root_url, str(PurePosixPath('json', 'recent_captures')))
505
- else:
521
+ if timestamp:
506
522
  if isinstance(timestamp, datetime):
507
523
  timestamp = timestamp.timestamp()
508
524
  url = urljoin(self.root_url, str(PurePosixPath('json', 'recent_captures', str(timestamp))))
525
+ else:
526
+ url = urljoin(self.root_url, str(PurePosixPath('json', 'recent_captures')))
527
+ r = self.session.get(url)
528
+ return r.json()
529
+
530
+ def get_categories_captures(self, category: str | None=None) -> list[str] | dict[str, list[str]] | None:
531
+ '''Get uuids for a specific category or all categorized uuids if category is None
532
+
533
+ :param category: The category according to which the uuids are to be returned
534
+ '''
535
+ if category:
536
+ url = urljoin(self.root_url, str(PurePosixPath('json', 'categories', category)))
537
+ else:
538
+ url = urljoin(self.root_url, str(PurePosixPath('json', 'categories')))
509
539
  r = self.session.get(url)
510
540
  return r.json()
511
541
 
@@ -0,0 +1,49 @@
1
+ [project]
2
+ name = "pylookyloo"
3
+ version = "1.27.0"
4
+ description = "Python CLI and module for Lookyloo"
5
+ authors = [
6
+ {name="Raphaël Vinot", email="raphael.vinot@circl.lu"}
7
+ ]
8
+ license = "BSD-3-Clause"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+
12
+ dynamic = [ "classifiers" ]
13
+
14
+ dependencies = [
15
+ "requests (>=2.32.3)"
16
+ ]
17
+
18
+ [project.urls]
19
+ repository = "https://github.com/lookyloo/PyLookyloo"
20
+ issues = "https://github.com/lookyloo/PyLookyloo/issues"
21
+ documentation = "https://pylookyloo.readthedocs.io/en/latest/"
22
+
23
+ [tool.poetry]
24
+ classifiers = [
25
+ 'Development Status :: 5 - Production/Stable',
26
+ 'Environment :: Console',
27
+ 'Operating System :: POSIX :: Linux',
28
+ 'Intended Audience :: Science/Research',
29
+ 'Intended Audience :: Telecommunications Industry',
30
+ 'Intended Audience :: Information Technology',
31
+ 'Topic :: Security',
32
+ 'Topic :: Internet',
33
+ ]
34
+
35
+ [project.scripts]
36
+ lookyloo = 'pylookyloo:main'
37
+
38
+ [project.optional-dependencies]
39
+
40
+ docs = ["Sphinx (>=8.1.3) ; python_version >= \"3.10\""]
41
+
42
+ [tool.poetry.group.dev.dependencies]
43
+ mypy = "^1.14.1"
44
+ types-requests = "^2.32.0.20241016"
45
+ pytest = "^8.3.4"
46
+
47
+ [build-system]
48
+ requires = ["poetry-core>=2.0"]
49
+ build-backend = "poetry.core.masonry.api"
@@ -1,55 +0,0 @@
1
- [tool.poetry]
2
- name = "pylookyloo"
3
- version = "1.25.0"
4
- description = "Python CLI and module for Lookyloo"
5
- authors = ["Raphaël Vinot <raphael.vinot@circl.lu>"]
6
- license = "BSD-3-Clause"
7
- repository = "https://github.com/lookyloo/PyLookyloo"
8
- documentation = "https://pylookyloo.readthedocs.io/en/latest/"
9
-
10
- readme = "README.md"
11
-
12
- classifiers = [
13
- 'License :: OSI Approved :: BSD License',
14
- 'Development Status :: 5 - Production/Stable',
15
- 'Environment :: Console',
16
- 'Operating System :: POSIX :: Linux',
17
- 'Intended Audience :: Science/Research',
18
- 'Intended Audience :: Telecommunications Industry',
19
- 'Intended Audience :: Information Technology',
20
- 'Programming Language :: Python :: 3.8',
21
- 'Programming Language :: Python :: 3.9',
22
- 'Programming Language :: Python :: 3.10',
23
- 'Programming Language :: Python :: 3.11',
24
- 'Programming Language :: Python :: 3.12',
25
- 'Topic :: Security',
26
- 'Topic :: Internet',
27
- ]
28
-
29
- [tool.poetry.scripts]
30
- lookyloo = 'pylookyloo:main'
31
-
32
- [tool.poetry.dependencies]
33
- python = "^3.8"
34
- requests = "^2.32.3"
35
- Sphinx = [
36
- {version = "<7.2", python = "<3.9", optional = true},
37
- {version = "^7.2", python = ">=3.9", optional = true}
38
- ]
39
-
40
- [tool.poetry.group.dev.dependencies]
41
- mypy = "^1.10.1"
42
- types-requests = "^2.32.0.20240622"
43
- ipython = [
44
- {version = "<8.13.0", python = "<3.9"},
45
- {version = "^8.18.0", python = ">=3.9"},
46
- {version = "^8.19.0", python = ">=3.10"}
47
- ]
48
- pytest = "^8.2.2"
49
-
50
- [tool.poetry.extras]
51
- docs = ["Sphinx"]
52
-
53
- [build-system]
54
- requires = ["poetry_core"]
55
- build-backend = "poetry.core.masonry.api"
File without changes
File without changes