=============
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.8+-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.7.0
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": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "stellar, stellar-model, pydantic",
"author": "overcat",
"author_email": "4catcode@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c4/8e/15a723d8743960e186af4448bda199cedcbfa5d2fbb3d0e1a9e068236798/stellar_model-0.7.0.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.8+-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.7.0\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.7.0",
"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": "89b49ef1aafde31dd376f571ac579f7848369a38d5a2ef87469723a99419987c",
"md5": "3a06394bcc67bdcb32760f4bfb63b336",
"sha256": "460a426f0f0755d34578b7869560cce2cdb426c3de83f33faaec57e98916d9dc"
},
"downloads": -1,
"filename": "stellar_model-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3a06394bcc67bdcb32760f4bfb63b336",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 50413,
"upload_time": "2025-08-17T14:03:00",
"upload_time_iso_8601": "2025-08-17T14:03:00.858587Z",
"url": "https://files.pythonhosted.org/packages/89/b4/9ef1aafde31dd376f571ac579f7848369a38d5a2ef87469723a99419987c/stellar_model-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c48e15a723d8743960e186af4448bda199cedcbfa5d2fbb3d0e1a9e068236798",
"md5": "01ddec0ef40c1938f52c330359263898",
"sha256": "270c6259e89127b056bc92e99cda9145ace7b62e5568697b78565e6260923a54"
},
"downloads": -1,
"filename": "stellar_model-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "01ddec0ef40c1938f52c330359263898",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 25816,
"upload_time": "2025-08-17T14:03:02",
"upload_time_iso_8601": "2025-08-17T14:03:02.519378Z",
"url": "https://files.pythonhosted.org/packages/c4/8e/15a723d8743960e186af4448bda199cedcbfa5d2fbb3d0e1a9e068236798/stellar_model-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-17 14:03:02",
"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"
}