sockudo-http-python 2.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.
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.4
2
+ Name: sockudo-http-python
3
+ Version: 2.0.0
4
+ Summary: High-performance Python HTTP server SDK for Sockudo
5
+ Author: Sockudo
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/sockudo/sockudo/tree/master/server-sdks/sockudo-http-python
8
+ Project-URL: Repository, https://github.com/sockudo/sockudo
9
+ Project-URL: Issues, https://github.com/sockudo/sockudo/issues
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: httpx[http2]>=0.27.0
14
+ Requires-Dist: PyNaCl>=1.5.0
15
+ Provides-Extra: dev
16
+ Requires-Dist: build>=1.2.2; extra == "dev"
17
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
18
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
19
+ Requires-Dist: ruff>=0.9.0; extra == "dev"
20
+ Requires-Dist: twine>=6.0.0; extra == "dev"
21
+ Dynamic: license-file
22
+
23
+ # Sockudo Python HTTP Server SDK
24
+
25
+ High-performance Python server SDK for the Sockudo HTTP API. It publishes events, signs channel and user authentication payloads, validates webhooks, queries channel state, reads durable history, mutates versioned messages, and manages annotations.
26
+
27
+ ## Features
28
+
29
+ - Sync and asyncio clients: `Sockudo` and `AsyncSockudo`
30
+ - Persistent HTTP connection pooling via `httpx`, with HTTP/2 enabled by default
31
+ - Pusher-compatible signed REST requests
32
+ - Single, multi-channel, and batch publishing
33
+ - Explicit and automatic idempotency keys for safe publish retries
34
+ - Private, presence, user, and webhook authentication helpers
35
+ - Channel state, presence users, durable history, and presence history APIs
36
+ - Versioned message APIs: get, versions, update, delete, append
37
+ - Annotation APIs: publish, list, delete
38
+ - Operator controls for history reset/purge and presence-history reset
39
+ - End-to-end encrypted channel auth, publish, batch publish, and webhook decrypt support for `private-encrypted-*` channels
40
+
41
+ ## Install
42
+
43
+ For apps, install the published package:
44
+
45
+ ```bash
46
+ pip install sockudo-http-python
47
+ ```
48
+
49
+ For local monorepo development, install from the local path:
50
+
51
+ ```bash
52
+ git clone https://github.com/sockudo/sockudo.git
53
+ pip install -e sockudo/server-sdks/sockudo-http-python
54
+ ```
55
+
56
+ For local development from this monorepo:
57
+
58
+ ```bash
59
+ pip install -e server-sdks/sockudo-http-python[dev]
60
+ ```
61
+
62
+ ## Quick Start
63
+
64
+ ```python
65
+ from sockudo_http import Config, Sockudo
66
+
67
+ sockudo = Sockudo(Config(app_id="app-id", key="app-key", secret="app-secret", host="127.0.0.1", port=6001))
68
+
69
+ result = sockudo.trigger("orders", "order.created", {"id": "ord_123"})
70
+ assert result.ok
71
+ sockudo.close()
72
+ ```
73
+
74
+ Async:
75
+
76
+ ```python
77
+ from sockudo_http_python import AsyncSockudo, SockudoOptions
78
+
79
+ async with AsyncSockudo(
80
+ "app-id",
81
+ "app-key",
82
+ "app-secret",
83
+ options=SockudoOptions(host="127.0.0.1", port=6001),
84
+ ) as sockudo:
85
+ await sockudo.trigger("orders", "order.created", {"id": "ord_123"})
86
+ ```
87
+
88
+ ## Idempotent Publishing
89
+
90
+ ```python
91
+ from sockudo_http_python import TriggerOptions
92
+
93
+ sockudo.trigger(
94
+ "orders",
95
+ "order.created",
96
+ {"id": "ord_123"},
97
+ TriggerOptions(idempotency_key="order-created-ord_123"),
98
+ )
99
+
100
+ sockudo.trigger("orders", "order.created", {"id": "ord_124"}, TriggerOptions(idempotency_key=True))
101
+ ```
102
+
103
+ Set `SockudoOptions(auto_idempotency=True)` to generate keys for publish and batch publish calls that omit one.
104
+
105
+ Target a single user channel:
106
+
107
+ ```python
108
+ sockudo.send_to_user("user-123", "notice", {"body": "hello"})
109
+ ```
110
+
111
+ ## Authentication Helpers
112
+
113
+ ```python
114
+ from sockudo_http_python import PresenceUser
115
+
116
+ private_body = sockudo.authenticate("123.456", "private-orders")
117
+
118
+ presence_body = sockudo.authenticate(
119
+ "123.456",
120
+ "presence-room",
121
+ PresenceUser("user-1", {"name": "Ada"}),
122
+ )
123
+
124
+ user_body = sockudo.authenticate_user("123.456", {"id": "user-1", "name": "Ada"})
125
+ ```
126
+
127
+ Encrypted channel auth responses include `shared_secret` when `encryption_master_key_base64` is configured:
128
+
129
+ ```python
130
+ encrypted = Sockudo(
131
+ "app-id",
132
+ "app-key",
133
+ "app-secret",
134
+ encryption_master_key_base64="base64-encoded-32-byte-key",
135
+ )
136
+
137
+ body = encrypted.authenticate("123.456", "private-encrypted-room")
138
+ ```
139
+
140
+ ## Channel And History APIs
141
+
142
+ ```python
143
+ from sockudo_http_python import ChannelsParams, HistoryParams, PresenceHistoryParams
144
+
145
+ sockudo.list_channels(ChannelsParams(filter_by_prefix="presence-", info=["subscription_count", "user_count"]))
146
+ sockudo.get_channel_users("presence-room")
147
+ sockudo.get_channel_history("orders", HistoryParams(limit=50, direction="newest_first"))
148
+ sockudo.get_channel_presence_history("presence-room", PresenceHistoryParams(limit=50))
149
+ ```
150
+
151
+ ## Versioned Messages And Annotations
152
+
153
+ ```python
154
+ from sockudo_http_python import MessageMutation, PublishAnnotationRequest
155
+
156
+ sockudo.get_message("orders", "msg:1")
157
+ sockudo.get_message_versions("orders", "msg:1")
158
+ sockudo.update_message("orders", "msg:1", MessageMutation(data={"status": "paid"}))
159
+ sockudo.append_message("orders", "msg:1", " appended text")
160
+ sockudo.delete_message("orders", "msg:1", MessageMutation(description="moderated"))
161
+
162
+ sockudo.publish_annotation(
163
+ "orders",
164
+ "msg:1",
165
+ PublishAnnotationRequest(type="reactions:distinct.v1", name="like", client_id="user-1", count=1),
166
+ )
167
+ sockudo.list_annotations("orders", "msg:1")
168
+ ```
169
+
170
+ ## Webhooks
171
+
172
+ ```python
173
+ validity = sockudo.validate_webhook_signature(x_pusher_key, x_pusher_signature, raw_body)
174
+ webhook = sockudo.parse_webhook(x_pusher_key, x_pusher_signature, raw_body)
175
+ ```
176
+
177
+ If a webhook contains encrypted channel events and the client has an encryption master key, `parse_webhook` decrypts those event payloads.
178
+
179
+ ## Signed URIs
180
+
181
+ ```python
182
+ uri = sockudo.signed_uri("GET", "/apps/app-id/channels", parameters={"filter_by_prefix": "presence-"})
183
+ ```
184
+
185
+ The signing format matches Sockudo/Pusher REST auth: `auth_key`, `auth_timestamp`, `auth_version`, optional `body_md5`, and `auth_signature` over `{METHOD}\n{PATH}\n{SORTED_QUERY}`.
186
+
187
+ ## URL Configuration
188
+
189
+ ```python
190
+ sockudo = Sockudo.from_url("http://app-key:app-secret@127.0.0.1:6001/apps/app-id")
191
+ ```
@@ -0,0 +1,8 @@
1
+ sockudo_http/__init__.py,sha256=YvVKXlTgEp2u7Yf1p7ONWWKg1VauS6bm2dCByaX1s2c,53
2
+ sockudo_http_python/__init__.py,sha256=PsWB_Hn0BzSuM9Y8KNJnLYUWuzloqSwwRH3rIDJOm6o,1145
3
+ sockudo_http_python/client.py,sha256=42_P043iGslDmmjx--Nvpg9endgYItVhQg4DYcWLJkI,60998
4
+ sockudo_http_python-2.0.0.dist-info/licenses/LICENSE,sha256=Rfu09RfZYgdX4dvZwzmFVt2wfFYH87DKhvRy886D8Os,1064
5
+ sockudo_http_python-2.0.0.dist-info/METADATA,sha256=NgCRkr-RXzYDn1uZcLKD8D64F48pGceuccxpbMqj_ck,5922
6
+ sockudo_http_python-2.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
7
+ sockudo_http_python-2.0.0.dist-info/top_level.txt,sha256=saTZU7c-zhgTxNxavzQ5c0XSPa5G55wvsQLSq32R_4o,33
8
+ sockudo_http_python-2.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sockudo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ sockudo_http
2
+ sockudo_http_python