Metadata-Version: 2.4
Name: stellar-horizon
Version: 0.1.1
Summary: A typed Python client for the Stellar Horizon API.
Keywords: stellar,horizon,stellar-sdk,api-client
Author: overcat
Author-email: overcat <hi@overcat.dev>
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: Free Threading :: 3 - Stable
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: anyio>=4.10,<5
Requires-Dist: httpx2>=2.16,<3
Requires-Dist: pydantic>=2.9,<3
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/lightsail-network/py-stellar-horizon
Project-URL: Documentation, https://stellar-horizon.readthedocs.io/
Project-URL: Repository, https://github.com/lightsail-network/py-stellar-horizon
Project-URL: Issues, https://github.com/lightsail-network/py-stellar-horizon/issues
Project-URL: Changelog, https://github.com/lightsail-network/py-stellar-horizon/blob/main/CHANGELOG.md
Description-Content-Type: text/markdown

# py-stellar-horizon

A typed Python client for [Horizon](https://developers.stellar.org/docs/data/apis/horizon),
the REST API of the [Stellar](https://stellar.org) network. It reads from Horizon and
submits transactions; to build and sign them, use the
[Python Stellar SDK](https://github.com/StellarCN/py-stellar-base).

> [!WARNING]
> Releases before 1.0 may still change the API.

> [!NOTE]
> Horizon is nearing its end of life and gets no new features. For new projects, look at
> [Stellar RPC](https://developers.stellar.org/docs/data/apis/rpc) first. This package is
> for applications that need what only Horizon offers.

The [documentation](https://stellar-horizon.readthedocs.io/) has the guide and the API
reference.

## Install

```shell
pip install stellar-horizon
```

## Example

```py
from stellar_horizon import HorizonClient

ACCOUNT = "GALAXYVOIDAOPZTDLHILAJQKCVVFMD4IKLXLSZV5YHO7VY74IWZILUTO"

with HorizonClient("https://horizon.stellar.org") as client:
    account = client.accounts.get(ACCOUNT)
    for balance in account.balances:
        print(f"{balance.balance:f} {balance.asset_code or balance.asset_type}")

    for payment in client.payments.list(account=account.account_id, order="desc"):
        print(f"{payment.created_at}: {payment.type}")

    with client.ledgers.stream() as stream:
        for ledger in stream:
            print(f"ledger {ledger.sequence} closed at {ledger.closed_at}")
```

The [guide](https://stellar-horizon.readthedocs.io/en/latest/guide/) covers paging,
streaming, submitting transactions and errors, and `AsyncHorizonClient`, the same
client for `asyncio`.

## Development

The project uses [uv](https://docs.astral.sh/uv/).

```shell
make check       # lint, type-check and test
make docs-serve  # preview the documentation
```

## License

[Apache-2.0](LICENSE)
