Metadata-Version: 2.4
Name: data-extractor
Version: 0.5.4
Summary: Combine XPath, CSS Selectors and JSONPath for Web data extracting.
Home-page: https://github.com/linw1995/data_extractor
Author: linw1995
Author-email: linw1995@icloud.com
Requires-Python: >=3.7,<4.0
License-File: LICENSE
Requires-Dist: cssselect<2.0.0,>=1.0.3
Requires-Dist: jsonpath-rw-ext<2.0,>=1.2
Requires-Dist: jsonpath-rw<2.0.0,>=1.4.0
Requires-Dist: lxml<5.0.0,>=4.3.0
Provides-Extra: docs
Requires-Dist: sphinx<3.0,>=2.2; extra == "docs"
Provides-Extra: linting
Requires-Dist: black<20.0,>=19.3b0; extra == "linting"
Requires-Dist: flake8<4.0.0,>=3.7.8; extra == "linting"
Requires-Dist: isort<5.0.0,>=4.3.21; extra == "linting"
Requires-Dist: mypy<0.731,>=0.730; extra == "linting"
Requires-Dist: pytest<6.0.0,>=5.2.0; extra == "linting"
Requires-Dist: doc8<0.9.0,>=0.8.0; extra == "linting"
Requires-Dist: pygments<3.0,>=2.4; extra == "linting"
Requires-Dist: flake8-bugbear<20.0,>=19.8; extra == "linting"
Requires-Dist: blacken-docs<2.0,>=1.3; extra == "linting"
Provides-Extra: test
Requires-Dist: pytest<6.0.0,>=5.2.0; extra == "test"
Requires-Dist: pytest-cov<3.0.0,>=2.7.1; extra == "test"
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: home-page
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

==============
Data Extractor
==============

|license| |Pypi Status| |Python version| |Package version| |PyPI - Downloads|
|GitHub last commit| |Code style: black| |Build Status| |codecov|
|Documentation Status|

Combine **XPath**, **CSS Selectors** and **JSONPath** for Web data extracting.

Quickstarts
<<<<<<<<<<<

Installation
~~~~~~~~~~~~

Install the stable version from PYPI.

.. code-block:: shell

    pip install data-extractor

Or install the latest version from Github.

.. code-block:: shell

    pip install git+https://github.com/linw1995/data_extractor.git@master

Usage
~~~~~

.. code-block:: python3

    from data_extractor import Field, Item, JSONExtractor


    class Count(Item):
        followings = Field(JSONExtractor("countFollowings"))
        fans = Field(JSONExtractor("countFans"))


    class User(Item):
        name_ = Field(JSONExtractor("name"), name="name")
        age = Field(JSONExtractor("age"), default=17)
        count = Count()


    assert User(JSONExtractor("data.users[*]"), is_many=True).extract(
        {
            "data": {
                "users": [
                    {
                        "name": "john",
                        "age": 19,
                        "countFollowings": 14,
                        "countFans": 212,
                    },
                    {
                        "name": "jack",
                        "description": "",
                        "countFollowings": 54,
                        "countFans": 312,
                    },
                ]
            }
        }
    ) == [
        {"name": "john", "age": 19, "count": {"followings": 14, "fans": 212}},
        {"name": "jack", "age": 17, "count": {"followings": 54, "fans": 312}},
    ]

Changelog
<<<<<<<<<

v0.5.4
~~~~~~

- 9552c79 Fix:Simplified item's extract_first method fail to raise ExtractError
- 08167ab Fix:Simplified item's extract_first method
  should support param default

- 6e4c269 New:More unittest for testing the simplified items
- a35b85a Chg:Update poetry.lock
- e5ff37b Docs,Chg:Update travis-ci status source in the README.rst


.. |license| image:: https://img.shields.io/github/license/linw1995/data_extractor.svg
    :target: https://github.com/linw1995/data_extractor/blob/master/LICENSE

.. |Pypi Status| image:: https://img.shields.io/pypi/status/data_extractor.svg
    :target: https://pypi.org/project/data_extractor

.. |Python version| image:: https://img.shields.io/pypi/pyversions/data_extractor.svg
    :target: https://pypi.org/project/data_extractor

.. |Package version| image:: https://img.shields.io/pypi/v/data_extractor.svg
    :target: https://pypi.org/project/data_extractor

.. |PyPI - Downloads| image:: https://img.shields.io/pypi/dm/data-extractor.svg
    :target: https://pypi.org/project/data_extractor

.. |GitHub last commit| image:: https://img.shields.io/github/last-commit/linw1995/data_extractor.svg
    :target: https://github.com/linw1995/data_extractor

.. |Code style: black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/ambv/black

.. |Build Status| image:: https://travis-ci.com/linw1995/data_extractor.svg?branch=master
    :target: https://travis-ci.com/linw1995/data_extractor

.. |codecov| image:: https://codecov.io/gh/linw1995/data_extractor/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/linw1995/data_extractor

.. |Documentation Status| image:: https://readthedocs.org/projects/data-extractor/badge/?version=latest
    :target: https://data-extractor.readthedocs.io/en/latest/?badge=latest
