-
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added python example for HTTP
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,33 @@ REQUEST: `{"jsonrpc":"2.0"}` | |
|
||
RESPONSE: `{"jsonrpc":"2.0","error":{"code":-32600,"message":"method field must be set","data":null},"id":null}` | ||
|
||
=== Python examples | ||
|
||
==== HTTP | ||
|
||
Let's suppose, the daemon was started like that: `signal-cli -a ACCOUNT daemon --http 'localhost:8000'` | ||
|
||
Then minimal example to interact with it will be: | ||
```python | ||
import requests | ||
import random | ||
|
||
# 'id' must be or you'll get '201' answer | ||
x = {"jsonrpc": "2.0", "method": "listGroups", "id": random.randint(1, 999)} | ||
|
||
# '/api/v1/rpc' is a undocumented but obligatory part of path to API | ||
response = requests.post("http://localhost:8000/api/v1/rpc", json=x) | ||
response.json() | ||
``` | ||
|
||
==== Websockets | ||
|
||
I failed to achieve any kind of responce with `websockets` | ||
|
||
==== TCP | ||
|
||
I failed to achieve any kind of responce with `socket` and connection always brakes with `zmq` | ||
|
||
== Authors | ||
|
||
Maintained by AsamK <[email protected]>, who is assisted by other open source contributors. | ||
|