Skip to main content

Parse the raw Stellar data into Python models.

Project description

GitHub Action Read the Docs PyPI Python - Version

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.

pip install stellar-model==0.5.1

Example

import requests
from stellar_model import AccountResponse

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

Of course you can use it with stellar-sdk.

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.parse_obj(raw_resp)
print(f"Account Sequence: {parsed_resp.sequence}")

Documentation

stellar-model’s documentation can be found at https://stellar-model.readthedocs.io

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stellar-model-0.5.1.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stellar_model-0.5.1-py3-none-any.whl (48.9 kB view details)

Uploaded Python 3

File details

Details for the file stellar-model-0.5.1.tar.gz.

File metadata

  • Download URL: stellar-model-0.5.1.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for stellar-model-0.5.1.tar.gz
Algorithm Hash digest
SHA256 3ae47b9cf58d4be944595f2b08545f65297f2de6f05cee064188aafe0ac06535
MD5 10c41d8f1bf8ed8f4b7edf35a3333d0b
BLAKE2b-256 b31c2fc816e62dd180e4cae77d3528a645cbd7ff07fa33a43871038b92d85d2d

See more details on using hashes here.

File details

Details for the file stellar_model-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: stellar_model-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 48.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for stellar_model-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 81f2a2b1f54111d14ad626e1559d7183e924a4503c381b88fb27d3fcc11cc13a
MD5 bc7ef523f1897b3d564bddbc3f7e88be
BLAKE2b-256 7c3465a2aefbac10ffe841e603bc76ad8b552e9f23de5d90442ffbbb08ec4852

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page