Skip to content

Commit 00ab4ba

Browse files
committed
Support JSONPath ext syntax
1 parent f05bf01 commit 00ab4ba

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

data_extractor/json.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from typing import Any
77

88
# Third Party Library
9-
import jsonpath_rw
9+
import jsonpath_rw_ext
1010

1111
from jsonpath_rw.lexer import JsonPathLexerError
1212

@@ -35,7 +35,7 @@ def extract(self, element: Any) -> Any:
3535
:raises data_extractor.exceptions.ExprError: JSONPath Expression Error.
3636
"""
3737
try:
38-
finder = jsonpath_rw.parse(self.expr)
38+
finder = jsonpath_rw_ext.parse(self.expr)
3939
except (JsonPathLexerError, Exception) as exc:
4040
raise ExprError(extractor=self, exc=exc)
4141

poetry.lock

Lines changed: 23 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "data_extractor"
3-
version = "0.4.0.dev0"
3+
version = "0.4.0.dev1"
44
license = "MIT"
55
description = "Combine XPath, CSS Selector and JSONPath for Web data extracting."
66
authors = ["linw1995 <[email protected]>"]
@@ -26,6 +26,7 @@ python = "^3.7"
2626
cssselect = "^1.0.3"
2727
jsonpath-rw = "^1.4.0"
2828
lxml = "^4.3.0"
29+
jsonpath-rw-ext = "^1.2"
2930

3031
[tool.poetry.dev-dependencies]
3132
rope = "^0.14.0"

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ warn_unused_ignores = true
6262
[mypy-jsonpath_rw.*]
6363
ignore_missing_imports = true
6464

65+
[mypy-jsonpath_rw_ext.*]
66+
ignore_missing_imports = true
67+
6568
[mypy-lxml.*]
6669
ignore_missing_imports = true
6770

0 commit comments

Comments
 (0)