zenbroker 0.4__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zenbroker/__init__.py +1 -2
- zenbroker/client.py +3 -7
- zenbroker-1.0.0.dist-info/METADATA +68 -0
- zenbroker-1.0.0.dist-info/RECORD +6 -0
- zenbroker-0.4.dist-info/METADATA +0 -12
- zenbroker-0.4.dist-info/RECORD +0 -6
- {zenbroker-0.4.dist-info → zenbroker-1.0.0.dist-info}/WHEEL +0 -0
- {zenbroker-0.4.dist-info → zenbroker-1.0.0.dist-info}/top_level.txt +0 -0
zenbroker/__init__.py
CHANGED
zenbroker/client.py
CHANGED
@@ -2,10 +2,6 @@ import httpx
|
|
2
2
|
from typing import Dict, Any
|
3
3
|
from pydantic import BaseModel, Field, HttpUrl
|
4
4
|
|
5
|
-
class ZenbrokerClientOptions(BaseModel):
|
6
|
-
base_url: HttpUrl = Field(..., description="URL of the broker service.")
|
7
|
-
application_id: str = Field(..., description="Application ID")
|
8
|
-
|
9
5
|
class PostPublishEventPayload(BaseModel):
|
10
6
|
applicationId: str = Field(..., description="Application ID")
|
11
7
|
channel: str = Field(..., description="ChannelID")
|
@@ -16,9 +12,9 @@ class PostPublishEventResponse(BaseModel):
|
|
16
12
|
id: str = Field(..., description="ID of the message")
|
17
13
|
|
18
14
|
class ZenbrokerClient:
|
19
|
-
def __init__(self,
|
20
|
-
self._url: str = str(
|
21
|
-
self._application_id: str = str(
|
15
|
+
def __init__(self, base_url: HttpUrl, application_id: str) -> None:
|
16
|
+
self._url: str = str(base_url)
|
17
|
+
self._application_id: str = str(application_id)
|
22
18
|
|
23
19
|
self._api = httpx.Client(base_url=self._url)
|
24
20
|
|
@@ -0,0 +1,68 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: zenbroker
|
3
|
+
Version: 1.0.0
|
4
|
+
Summary: Zenbroker client
|
5
|
+
Home-page: UNKNOWN
|
6
|
+
License: UNKNOWN
|
7
|
+
Platform: UNKNOWN
|
8
|
+
Description-Content-Type: text/markdown
|
9
|
+
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
10
|
+
Requires-Dist: httpx<1.0.0,>=0.28.0
|
11
|
+
|
12
|
+
# Zenbroker Client Example
|
13
|
+
|
14
|
+
This project demonstrates how to use the Zenbroker client library to publish messages to channels.
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
```bash
|
19
|
+
pip install zenbroker
|
20
|
+
```
|
21
|
+
|
22
|
+
## Configuration
|
23
|
+
|
24
|
+
You need to configure your Zenbroker client with your application ID:
|
25
|
+
|
26
|
+
```python
|
27
|
+
from zenbroker import ZenbrokerClient
|
28
|
+
|
29
|
+
client = ZenbrokerClient(
|
30
|
+
application_id="YOUR_APPLICATION_ID",
|
31
|
+
base_url="https://broker.oraczen.xyz"
|
32
|
+
)
|
33
|
+
```
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
### Publishing a single message
|
38
|
+
|
39
|
+
```python
|
40
|
+
resp = client.publish(
|
41
|
+
channel="CHANNEL-ID",
|
42
|
+
data={
|
43
|
+
"key": "value",
|
44
|
+
"message": "hello"
|
45
|
+
}
|
46
|
+
)
|
47
|
+
```
|
48
|
+
|
49
|
+
### Publishing multiple messages
|
50
|
+
|
51
|
+
```python
|
52
|
+
for i in range(10000):
|
53
|
+
resp = client.publish(
|
54
|
+
channel="testing-channel",
|
55
|
+
data={
|
56
|
+
"index": i,
|
57
|
+
"message": "Hey There"
|
58
|
+
}
|
59
|
+
)
|
60
|
+
print("DONE", i)
|
61
|
+
```
|
62
|
+
|
63
|
+
## Notes
|
64
|
+
|
65
|
+
- Replace `YOUR_APPLICATION_ID` with your actual application ID
|
66
|
+
- Replace `CHANNEL-ID` with your target channel ID when publishing messages
|
67
|
+
|
68
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
zenbroker/__init__.py,sha256=J-UtdbKCUJ2xJVcng2slPY81nl015BHBTNNSE6ZAwvA,130
|
2
|
+
zenbroker/client.py,sha256=FDjIbV9yRhdbAsWp_kc-0GHqUYuAENlOI3b5l2ZB85o,1279
|
3
|
+
zenbroker-1.0.0.dist-info/METADATA,sha256=JC-XaDfw-tLx5mz6CiYJhuZynT_M50bNUwMGeVsAdaY,1257
|
4
|
+
zenbroker-1.0.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
5
|
+
zenbroker-1.0.0.dist-info/top_level.txt,sha256=u-V5a1mTLsnD3DQb01LQo8WtbYc75BIZ6jSWrZ7vDkY,10
|
6
|
+
zenbroker-1.0.0.dist-info/RECORD,,
|
zenbroker-0.4.dist-info/METADATA
DELETED
zenbroker-0.4.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
zenbroker/__init__.py,sha256=i7O6N_4p6LuYKp8uc6UohCELn2TI523-oNf97F_Kbjw,184
|
2
|
-
zenbroker/client.py,sha256=tCy1wARR0B7qDphMMuDMHengl_-KUZ2A4M26efLrqZI,1465
|
3
|
-
zenbroker-0.4.dist-info/METADATA,sha256=fTrirJwa_rPxzsnG2kvnmL-N4QLZ3j817tpdaHCkUPs,206
|
4
|
-
zenbroker-0.4.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
5
|
-
zenbroker-0.4.dist-info/top_level.txt,sha256=u-V5a1mTLsnD3DQb01LQo8WtbYc75BIZ6jSWrZ7vDkY,10
|
6
|
-
zenbroker-0.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|