mirror of
https://github.com/actix/examples
synced 2025-06-26 17:17:42 +02:00
Restructure folders (#411)
This commit is contained in:
committed by
GitHub
parent
9db98162b2
commit
c3407627d0
38
json/jsonrpc/tests/test_client.py
Normal file
38
json/jsonrpc/tests/test_client.py
Normal file
@ -0,0 +1,38 @@
|
||||
import requests
|
||||
|
||||
print('ping: pong immediately')
|
||||
r = requests.post('http://127.0.0.1:8080/', json={
|
||||
'jsonrpc': '2.0',
|
||||
'method': 'ping',
|
||||
'params': [],
|
||||
'id': 1
|
||||
})
|
||||
print(r.json())
|
||||
|
||||
|
||||
print('ping: pong after 4 secs')
|
||||
r = requests.post('http://127.0.0.1:8080/', json={
|
||||
'jsonrpc': '2.0',
|
||||
'method': 'wait',
|
||||
'params': [4],
|
||||
'id': 1
|
||||
})
|
||||
print(r.json())
|
||||
|
||||
for i in range(10):
|
||||
print(f'inc {i:>02}')
|
||||
r = requests.post('http://127.0.0.1:8080/', json={
|
||||
'jsonrpc': '2.0',
|
||||
'method': 'inc',
|
||||
'params': [],
|
||||
'id': 1
|
||||
})
|
||||
|
||||
print(f'get')
|
||||
r = requests.post('http://127.0.0.1:8080/', json={
|
||||
'jsonrpc': '2.0',
|
||||
'method': 'get',
|
||||
'params': [],
|
||||
'id': 1
|
||||
})
|
||||
print(r.json())
|
Reference in New Issue
Block a user