stellar-model


Namestellar-model JSON
Version 0.5.4 PyPI version JSON
download
home_pagehttps://github.com/StellarCN/stellar-model
SummaryParse the raw Stellar data into Python models.
upload_time2023-12-09 02:16:55
maintainer
docs_urlNone
authorovercat
requires_python>=3.7
licenseApache-2.0
keywords stellar stellar-model pydantic
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =============
stellar-model
=============
.. image:: https://img.shields.io/github/actions/workflow/status/StellarCN/stellar-model/continuous-integration-workflow.yml?branch=main&style=flat&maxAge=1800
    :alt: GitHub Action
    :target: https://github.com/StellarCN/stellar-model/actions

.. image:: https://img.shields.io/readthedocs/stellar-model.svg?style=flat&maxAge=1800
    :alt: Read the Docs
    :target: https://stellar-model.readthedocs.io/en/latest/

.. image:: https://img.shields.io/pypi/v/stellar-model.svg?style=flat&maxAge=1800
    :alt: PyPI
    :target: https://pypi.python.org/pypi/stellar-model

.. image:: https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue?style=flat
    :alt: Python - Version
    :target: https://pypi.python.org/pypi/stellar-model

`stellar-model`_ is based on `pydantic`_, you can use it to parse the JSON
returned by `Stellar Horizon`_ into Python models, through it, you can get a better
development experience in the editor with things like code completion, type hints, and more.

Installing
==========

You need to choose a suitable stellar-model version according to the Horizon version number you are using.
Please check the list `here <https://github.com/StellarCN/stellar-model/issues/20/>`_.

.. code-block:: text

    pip install stellar-model==0.5.4

Example
=======
.. code-block:: python

    import requests
    from stellar_model import AccountResponse

    url = "https://horizon.stellar.org/accounts/GALAXYVOIDAOPZTDLHILAJQKCVVFMD4IKLXLSZV5YHO7VY74IWZILUTO"
    raw_resp = requests.get(url).json()
    parsed_resp = AccountResponse.model_validate(raw_resp)
    print(f"Account Sequence: {parsed_resp.sequence}")


Of course you can use it with `stellar-sdk`_.

.. code-block:: python

    from stellar_sdk import Server
    from stellar_model import AccountResponse

    server = Server("https://horizon.stellar.org")
    account_id = "GALAXYVOIDAOPZTDLHILAJQKCVVFMD4IKLXLSZV5YHO7VY74IWZILUTO"
    raw_resp = server.accounts().account_id(account_id).call()
    parsed_resp = AccountResponse.model_validate(raw_resp)
    print(f"Account Sequence: {parsed_resp.sequence}")


Documentation
=============
stellar-model's documentation can be found at https://stellar-model.readthedocs.io


.. _stellar-model: https://github.com/StellarCN/stellar-model
.. _pydantic: https://pydantic-docs.helpmanual.io/
.. _Stellar Horizon: https://developers.stellar.org/api/resources/
.. _stellar-sdk: https://github.com/StellarCN/py-stellar-base

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/StellarCN/stellar-model",
    "name": "stellar-model",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "stellar,stellar-model,pydantic",
    "author": "overcat",
    "author_email": "4catcode@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/23/f8/0490018102f67ade8d47d31d06901bb3bf720b40429bf095dcfabd541875/stellar_model-0.5.4.tar.gz",
    "platform": null,
    "description": "=============\nstellar-model\n=============\n.. image:: https://img.shields.io/github/actions/workflow/status/StellarCN/stellar-model/continuous-integration-workflow.yml?branch=main&style=flat&maxAge=1800\n    :alt: GitHub Action\n    :target: https://github.com/StellarCN/stellar-model/actions\n\n.. image:: https://img.shields.io/readthedocs/stellar-model.svg?style=flat&maxAge=1800\n    :alt: Read the Docs\n    :target: https://stellar-model.readthedocs.io/en/latest/\n\n.. image:: https://img.shields.io/pypi/v/stellar-model.svg?style=flat&maxAge=1800\n    :alt: PyPI\n    :target: https://pypi.python.org/pypi/stellar-model\n\n.. image:: https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue?style=flat\n    :alt: Python - Version\n    :target: https://pypi.python.org/pypi/stellar-model\n\n`stellar-model`_ is based on `pydantic`_, you can use it to parse the JSON\nreturned by `Stellar Horizon`_ into Python models, through it, you can get a better\ndevelopment experience in the editor with things like code completion, type hints, and more.\n\nInstalling\n==========\n\nYou need to choose a suitable stellar-model version according to the Horizon version number you are using.\nPlease check the list `here <https://github.com/StellarCN/stellar-model/issues/20/>`_.\n\n.. code-block:: text\n\n    pip install stellar-model==0.5.4\n\nExample\n=======\n.. code-block:: python\n\n    import requests\n    from stellar_model import AccountResponse\n\n    url = \"https://horizon.stellar.org/accounts/GALAXYVOIDAOPZTDLHILAJQKCVVFMD4IKLXLSZV5YHO7VY74IWZILUTO\"\n    raw_resp = requests.get(url).json()\n    parsed_resp = AccountResponse.model_validate(raw_resp)\n    print(f\"Account Sequence: {parsed_resp.sequence}\")\n\n\nOf course you can use it with `stellar-sdk`_.\n\n.. code-block:: python\n\n    from stellar_sdk import Server\n    from stellar_model import AccountResponse\n\n    server = Server(\"https://horizon.stellar.org\")\n    account_id = \"GALAXYVOIDAOPZTDLHILAJQKCVVFMD4IKLXLSZV5YHO7VY74IWZILUTO\"\n    raw_resp = server.accounts().account_id(account_id).call()\n    parsed_resp = AccountResponse.model_validate(raw_resp)\n    print(f\"Account Sequence: {parsed_resp.sequence}\")\n\n\nDocumentation\n=============\nstellar-model's documentation can be found at https://stellar-model.readthedocs.io\n\n\n.. _stellar-model: https://github.com/StellarCN/stellar-model\n.. _pydantic: https://pydantic-docs.helpmanual.io/\n.. _Stellar Horizon: https://developers.stellar.org/api/resources/\n.. _stellar-sdk: https://github.com/StellarCN/py-stellar-base\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Parse the raw Stellar data into Python models.",
    "version": "0.5.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/StellarCN/stellar-mode/issues",
        "Documentation": "https://stellar-model.readthedocs.io",
        "Homepage": "https://github.com/StellarCN/stellar-model",
        "Repository": "https://github.com/StellarCN/stellar-model"
    },
    "split_keywords": [
        "stellar",
        "stellar-model",
        "pydantic"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "46a626bf540f0b2a436d2e94bb74485136ed362db8e5df598c09541d0a8f9c5f",
                "md5": "097b626ded64666ed92308dd20a418c8",
                "sha256": "baefa780b59f5fe56153799d7f6d7d324d6ac2c5fa9c12832c3d8973b169ecb6"
            },
            "downloads": -1,
            "filename": "stellar_model-0.5.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "097b626ded64666ed92308dd20a418c8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 49723,
            "upload_time": "2023-12-09T02:16:52",
            "upload_time_iso_8601": "2023-12-09T02:16:52.949553Z",
            "url": "https://files.pythonhosted.org/packages/46/a6/26bf540f0b2a436d2e94bb74485136ed362db8e5df598c09541d0a8f9c5f/stellar_model-0.5.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "23f80490018102f67ade8d47d31d06901bb3bf720b40429bf095dcfabd541875",
                "md5": "102bf9b579b33ca71a1e564cfb83a719",
                "sha256": "81024ccd310c8d932f2f361e3bbe90cf459af9f8d517c3db8a032fa0be923785"
            },
            "downloads": -1,
            "filename": "stellar_model-0.5.4.tar.gz",
            "has_sig": false,
            "md5_digest": "102bf9b579b33ca71a1e564cfb83a719",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 25801,
            "upload_time": "2023-12-09T02:16:55",
            "upload_time_iso_8601": "2023-12-09T02:16:55.193517Z",
            "url": "https://files.pythonhosted.org/packages/23/f8/0490018102f67ade8d47d31d06901bb3bf720b40429bf095dcfabd541875/stellar_model-0.5.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-09 02:16:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "StellarCN",
    "github_project": "stellar-model",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "stellar-model"
}
        
Elapsed time: 0.15705s