Skip to content

Commit 501fc48

Browse files
committed
Add python example
1 parent 305870d commit 501fc48

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@ public class RespProxyClient {
9595
}
9696
```
9797

98+
**Python Example:**
99+
```python
100+
import json
101+
import urllib.request
102+
103+
data = b">4\r\n$6\r\nMOVING\r\n:1\r\n:2\r\n$6\r\nhost:3\r\n"
104+
req = urllib.request.Request("http://localhost:3000/send-to-all-clients?encoding=raw", data)
105+
106+
with urllib.request.urlopen(req) as response:
107+
result = json.loads(response.read())
108+
print("Injected" if result["success"] else "Failed")
109+
```
110+
98111
Key Endpoints: `POST /send-to-client/{id}`, `POST /send-to-all-clients`, `GET /connections`, `GET /stats`
99112

100113
---

0 commit comments

Comments
 (0)