wxpath 0.5.0__py3-none-any.whl → 0.5.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.
- wxpath/core/exceptions.py +53 -0
- {wxpath-0.5.0.dist-info → wxpath-0.5.2.dist-info}/METADATA +9 -6
- {wxpath-0.5.0.dist-info → wxpath-0.5.2.dist-info}/RECORD +7 -6
- {wxpath-0.5.0.dist-info → wxpath-0.5.2.dist-info}/WHEEL +0 -0
- {wxpath-0.5.0.dist-info → wxpath-0.5.2.dist-info}/entry_points.txt +0 -0
- {wxpath-0.5.0.dist-info → wxpath-0.5.2.dist-info}/licenses/LICENSE +0 -0
- {wxpath-0.5.0.dist-info → wxpath-0.5.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
class XPathEvaluationError(Exception):
|
|
2
|
+
"""Errors during XPath evaluation with elementpath."""
|
|
3
|
+
|
|
4
|
+
def __init__(
|
|
5
|
+
self,
|
|
6
|
+
message: str,
|
|
7
|
+
xpath: str,
|
|
8
|
+
base_url: str | None = None,
|
|
9
|
+
element_tag: str | None = None,
|
|
10
|
+
error_code: str | None = None, # XPath error codes like XPST0003
|
|
11
|
+
position: tuple[int, int] | None = None, # (line, column)
|
|
12
|
+
original_error: Exception | None = None
|
|
13
|
+
):
|
|
14
|
+
context = {
|
|
15
|
+
"xpath": xpath,
|
|
16
|
+
"base_url": base_url,
|
|
17
|
+
"element_tag": element_tag,
|
|
18
|
+
"error_code": error_code,
|
|
19
|
+
"position": position,
|
|
20
|
+
}
|
|
21
|
+
if original_error:
|
|
22
|
+
context["original_error"] = str(original_error)
|
|
23
|
+
# Extract XPath error code if present (e.g., [err:XPST0003])
|
|
24
|
+
if hasattr(original_error, 'code'):
|
|
25
|
+
context["error_code"] = original_error.code
|
|
26
|
+
|
|
27
|
+
super().__init__(message, context)
|
|
28
|
+
|
|
29
|
+
def to_dict(self) -> dict:
|
|
30
|
+
return {
|
|
31
|
+
"message": self.message,
|
|
32
|
+
"xpath": self.xpath,
|
|
33
|
+
"base_url": self.base_url,
|
|
34
|
+
"element_tag": self.element_tag,
|
|
35
|
+
"error_code": self.error_code,
|
|
36
|
+
"position": self.position,
|
|
37
|
+
"original_error": self.original_error,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class XPathSyntaxError(XPathEvaluationError):
|
|
42
|
+
"""Invalid XPath syntax."""
|
|
43
|
+
pass
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class XPathTypeError(XPathEvaluationError):
|
|
47
|
+
"""Type error in XPath expression."""
|
|
48
|
+
pass
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class XPathRuntimeError(XPathEvaluationError):
|
|
52
|
+
"""Runtime error during XPath evaluation."""
|
|
53
|
+
pass
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wxpath
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: wxpath - a declarative web crawler and data extractor
|
|
5
5
|
Author-email: Rodrigo Palacios <rodrigopala91@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -14,7 +14,7 @@ Description-Content-Type: text/markdown
|
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Requires-Dist: lxml>=4.0
|
|
16
16
|
Requires-Dist: elementpath<=5.0.3,>=5.0.0
|
|
17
|
-
Requires-Dist: aiohttp<=
|
|
17
|
+
Requires-Dist: aiohttp<=4.0.0,>=3.8.0
|
|
18
18
|
Requires-Dist: tqdm>=4.0.0
|
|
19
19
|
Provides-Extra: cache
|
|
20
20
|
Requires-Dist: aiohttp-client-cache>=0.14.0; extra == "cache"
|
|
@@ -35,6 +35,7 @@ Requires-Dist: pytest>=7.0; extra == "test"
|
|
|
35
35
|
Requires-Dist: pytest-asyncio>=0.23; extra == "test"
|
|
36
36
|
Provides-Extra: dev
|
|
37
37
|
Requires-Dist: ruff; extra == "dev"
|
|
38
|
+
Requires-Dist: tox; extra == "dev"
|
|
38
39
|
Provides-Extra: docs
|
|
39
40
|
Requires-Dist: mkdocs>=1.5; extra == "docs"
|
|
40
41
|
Requires-Dist: mkdocs-material>=9.0; extra == "docs"
|
|
@@ -54,7 +55,7 @@ Dynamic: license-file
|
|
|
54
55
|
[](https://www.python.org/downloads/release/python-3100/) [](https://rodricios.github.io/wxpath)
|
|
55
56
|
|
|
56
57
|
|
|
57
|
-
> NEW: [TUI](https://rodricios.github.io/wxpath/tui/quickstart
|
|
58
|
+
> NEW: [TUI](https://rodricios.github.io/wxpath/tui/quickstart) - Interactive terminal interface (powered by Textual) for testing wxpath expressions and exporting data.
|
|
58
59
|
|
|
59
60
|

|
|
60
61
|
|
|
@@ -64,8 +65,10 @@ Requires Python 3.10+.
|
|
|
64
65
|
|
|
65
66
|
```
|
|
66
67
|
pip install wxpath
|
|
67
|
-
# For TUI support
|
|
68
|
-
pip install wxpath[tui]
|
|
68
|
+
# For TUI support:
|
|
69
|
+
pip install "wxpath[tui]"
|
|
70
|
+
# Immediately launch the TUI via uv:
|
|
71
|
+
uvx --from "wxpath[tui]" wxpath-tui
|
|
69
72
|
```
|
|
70
73
|
---
|
|
71
74
|
|
|
@@ -356,7 +359,7 @@ Command line options:
|
|
|
356
359
|
|
|
357
360
|
**wxpath** provides a terminal interface (TUI) for interactive expression testing and data extraction.
|
|
358
361
|
|
|
359
|
-
See [TUI Quickstart](https://rodricios.github.io/wxpath/tui/quickstart
|
|
362
|
+
See [TUI Quickstart](https://rodricios.github.io/wxpath/tui/quickstart) for more details.
|
|
360
363
|
|
|
361
364
|
## Persistence and Caching
|
|
362
365
|
|
|
@@ -6,6 +6,7 @@ wxpath/tui.py,sha256=CG8xvGnYNbruD4lw50Agu8RKKUJEpEl0WG0SyLBW4c8,42786
|
|
|
6
6
|
wxpath/tui_settings.py,sha256=rM2IBeOzQUIzjk2Ds1Jlnvb7IUtdJdKMN2j3GHk7Z9M,5051
|
|
7
7
|
wxpath/core/__init__.py,sha256=U9_In2iRaZrpiIVavIli1M59gCB6Kn1en-1Fza-qIiI,257
|
|
8
8
|
wxpath/core/dom.py,sha256=X0L3n8jRfO5evEypDaJTD-NQ3cLXWvnEUVERAHo3vV0,701
|
|
9
|
+
wxpath/core/exceptions.py,sha256=BwVoBWhulv24m13hZaQ3hlVYF8foiufiXZMAh7gESE0,1615
|
|
9
10
|
wxpath/core/models.py,sha256=xsNY9ZmUILB5_O1GHRkn3cLBtPs3-krguU5NlqFe0bM,1664
|
|
10
11
|
wxpath/core/ops.py,sha256=4vzLOqRM_LbXc1cAnWCuKGt2m_pbvyHO0p5ee2Upjog,9569
|
|
11
12
|
wxpath/core/parser.py,sha256=ufUSEfyR6aO10pV_E39-uSiLQfYvngNQnHcs1GJlpbA,21392
|
|
@@ -36,9 +37,9 @@ wxpath/util/cleaners.py,sha256=JtUwCKjSJV-qw2CBrcB1oYswBDeXiqndGiz3-MlxeG0,946
|
|
|
36
37
|
wxpath/util/common_paths.py,sha256=Y-0yq6IMjlSl1t4GbmK9TeJFTQ-MVvJOINhglvD4djA,980
|
|
37
38
|
wxpath/util/logging.py,sha256=hgN4OC1y2oZWewtL-O-Ei_1lOaadH9eSyo0Iz2t_s1c,2858
|
|
38
39
|
wxpath/util/serialize.py,sha256=uUs4C9VErpFd97smBM2bRWo2nW25kCgKdsMrVtVxhg8,575
|
|
39
|
-
wxpath-0.5.
|
|
40
|
-
wxpath-0.5.
|
|
41
|
-
wxpath-0.5.
|
|
42
|
-
wxpath-0.5.
|
|
43
|
-
wxpath-0.5.
|
|
44
|
-
wxpath-0.5.
|
|
40
|
+
wxpath-0.5.2.dist-info/licenses/LICENSE,sha256=AVBZLhdWmqxm-f-dy5prVB1E-solHWoP2EXEIV_o-00,1076
|
|
41
|
+
wxpath-0.5.2.dist-info/METADATA,sha256=-zpBLuhWEJbrZhCp3CGbuRpS7-J1_bQIpiW-c78lz1E,22105
|
|
42
|
+
wxpath-0.5.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
43
|
+
wxpath-0.5.2.dist-info/entry_points.txt,sha256=CSr67nPxU_tZ_XdAdDmvW9b9VRUhFAhGhEC41YNJEfE,72
|
|
44
|
+
wxpath-0.5.2.dist-info/top_level.txt,sha256=uFCcveG78mnefxRGvYsR2OexDlKR_Z1UD4vZijUcex8,7
|
|
45
|
+
wxpath-0.5.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|