https://github.com/official-stallion/client.py
Python client SDK for Stallion message broker.
https://github.com/official-stallion/client.py
python python3 sdk-python stallion
Last synced: about 13 hours ago
JSON representation
Python client SDK for Stallion message broker.
- Host: GitHub
- URL: https://github.com/official-stallion/client.py
- Owner: official-stallion
- License: mit
- Created: 2022-08-16T07:22:30.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-19T12:50:11.000Z (over 3 years ago)
- Last Synced: 2026-01-13T16:44:33.057Z (5 months ago)
- Topics: python, python3, sdk-python, stallion
- Language: Python
- Homepage:
- Size: 35.2 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Stallion Python SDK


Client SDK for Stallion message broker
## How to use?
Python install:
```shell
pip install stallion-python-sdk
```
### Client
Create a client:
```python
# importing Client module
from stallion.client import Client
# creating a client
# with given stallion server url
c = Client(url="st://localhost:9090")
```
### Publish
```python
# publish an object on a topic
c.Publish("book", {'author': "Amirhossein", 'name': "Stallion"})
```
### Subscribe
```python
# creating a handler
# any published object will be given to this handler as data
def handler(data):
print(f'{data['author']}: {data['name']})
# subscribe over a topic with given handler
c.Subscribe("book", handler)
```
### Unsubscribe
```python
# unsubscribe from a topic
c.Unsubscribe("book")
```