Skip to content

Commit a407a75

Browse files
committed
Adjust docs
1 parent 63cc92e commit a407a75

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

docs/requests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Generate a request with the `request` function:
1010
{'jsonrpc': '2.0', 'method': 'ping', 'id': 1}
1111
```
1212

13-
`request_json` gives you a string:
13+
`request_json` gives a string:
1414

1515
```py
1616
>>> request_json("ping")

docs/responses.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ Error(code=1, message='There was an error', data=None, id=1)
1111
```
1212

1313
If you have a string, use `parse_json`.
14+
1415
```python
1516
>>> parse_json('{"jsonrpc": "2.0", "result": "pong", "id": 1}')
1617
Ok(result='pong', id=1)
1718
```
1819

1920
To use the result, in Python versions prior to 3.10:
21+
2022
```python
2123
from jsonrpcclient import Error, Ok
2224
parsed = parse(response)
@@ -27,6 +29,7 @@ elif isinstance(parse, Error):
2729
```
2830

2931
In Python 3.10+, use pattern matching:
32+
3033
```python
3134
match parse(response):
3235
case Ok(result, id):

0 commit comments

Comments
 (0)