Skip to content

Commit

Permalink
Support JSONPath ext syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
linw1995 committed Sep 27, 2019
1 parent f05bf01 commit 00ab4ba
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
4 changes: 2 additions & 2 deletions data_extractor/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any

# Third Party Library
import jsonpath_rw
import jsonpath_rw_ext

from jsonpath_rw.lexer import JsonPathLexerError

Expand Down Expand Up @@ -35,7 +35,7 @@ def extract(self, element: Any) -> Any:
:raises data_extractor.exceptions.ExprError: JSONPath Expression Error.
"""
try:
finder = jsonpath_rw.parse(self.expr)
finder = jsonpath_rw_ext.parse(self.expr)
except (JsonPathLexerError, Exception) as exc:
raise ExprError(extractor=self, exc=exc)

Expand Down
24 changes: 23 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "data_extractor"
version = "0.4.0.dev0"
version = "0.4.0.dev1"
license = "MIT"
description = "Combine XPath, CSS Selector and JSONPath for Web data extracting."
authors = ["linw1995 <[email protected]>"]
Expand All @@ -26,6 +26,7 @@ python = "^3.7"
cssselect = "^1.0.3"
jsonpath-rw = "^1.4.0"
lxml = "^4.3.0"
jsonpath-rw-ext = "^1.2"

[tool.poetry.dev-dependencies]
rope = "^0.14.0"
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ warn_unused_ignores = true
[mypy-jsonpath_rw.*]
ignore_missing_imports = true

[mypy-jsonpath_rw_ext.*]
ignore_missing_imports = true

[mypy-lxml.*]
ignore_missing_imports = true

Expand Down

0 comments on commit 00ab4ba

Please sign in to comment.