Call the RESTful API
Used to call the RESTful API provided by the gateway. This interface allows access to gateway Micropython module functions that are not otherwise wrapped.
Refer RESTful API.
Example
1import asyncio
2import cassiablue
3
4
5async def cassia_info():
6 url = "/cassia/info"
7 ok, ret = await cassiablue.send_cmd(url)
8 print(type(ok), ok, type(ret), ret)
9
10
11async def main():
12 print("start send cmd")
13 url = "/cassia/info"
14 ok, ret = await cassiablue.send_cmd(url)
15 print("send cmd done:", type(ok), ok, type(ret), ret)
16
17
18asyncio.run(main())
API
- async cassiablue.send_cmd(path: str, method: str | None = 'GET', query: str | None = None, body: str | None = None) tuple[ok: bool, result: str]
Used to call the RESTful API provided by the gateway.
- Parameters:
path: API path
method: HTTP method
query: query parameter
body: body parameter
- Returns:
ok: Whether the execution was successful
result: Execution result