-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·31 lines (25 loc) · 845 Bytes
/
Copy pathtest.py
File metadata and controls
executable file
·31 lines (25 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import aiohttp
import asyncio
async def main():
headers = {
"accept": "application/json",
"Connection": "keep-alive",
"Content-Type": "application/json"
}
kwargs = {
"headers": headers,
'timeout': 5,
'chunked': True,
'data': None,
'params': None,
}
async with aiohttp.ClientSession() as session:
async with session.get('http://c02.meter.io:8669/blocks/11007996', **kwargs) as response:
print("Status:", response.status)
print("Content-type:", response.headers['content-type'])
result = await response.json()
print("JSON response:", result)
print("BLOCK: ", result['number'])
print("TXS: ", result['committee'])
loop = asyncio.get_event_loop()
loop.run_until_complete(main())