Parse the raw Stellar data into Python models.
Project description
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.6.0
Example
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.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file stellar_model-0.6.0.tar.gz
.
File metadata
- Download URL: stellar_model-0.6.0.tar.gz
- Upload date:
- Size: 25.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e0c878deb409290a9b080d438d1b779185be59718518e0f68f047df344dd792 |
|
MD5 | 7ea66cef51bb1dd9eb178bafa3c45feb |
|
BLAKE2b-256 | b1ba2fb52aea550a5ddb0b38f3738e106221bde7fdc5cad354c324ca9d2d2c1c |
Provenance
The following attestation bundles were made for stellar_model-0.6.0.tar.gz
:
Publisher:
continuous-integration-workflow.yml
on StellarCN/stellar-model
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
stellar_model-0.6.0.tar.gz
- Subject digest:
5e0c878deb409290a9b080d438d1b779185be59718518e0f68f047df344dd792
- Sigstore transparency entry: 149383813
- Sigstore integration time:
- Predicate type:
File details
Details for the file stellar_model-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: stellar_model-0.6.0-py3-none-any.whl
- Upload date:
- Size: 50.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72dd7bd7792091e6e84427f39eff5832a697998847e75a99dd5d40903dbfb46f |
|
MD5 | 6f41410a586e7dab1c7abf825ae19165 |
|
BLAKE2b-256 | 9732d15562dbcfdb1eaa8738be4a8048678477f5b5fe45c4840b4e6793b68fc4 |
Provenance
The following attestation bundles were made for stellar_model-0.6.0-py3-none-any.whl
:
Publisher:
continuous-integration-workflow.yml
on StellarCN/stellar-model
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
stellar_model-0.6.0-py3-none-any.whl
- Subject digest:
72dd7bd7792091e6e84427f39eff5832a697998847e75a99dd5d40903dbfb46f
- Sigstore transparency entry: 149383815
- Sigstore integration time:
- Predicate type: