飞牛fnOS的Python SDK。
Project description
pyfnos
飞牛fnOS的Python SDK。
注意:这个SDK非官方提供。
项目信息
- 源代码仓库: https://github.com/Timandes/pyfnos
- 问题追踪: GitHub Issues
上手
import asyncio
def on_message_handler(message):
"""消息回调处理函数"""
print(f"收到消息: {message}")
async def main():
client = FnosClient()
# 设置消息回调
client.on_message(on_message_handler)
# 连接到服务器
await client.connect()
# 等待连接建立
await asyncio.sleep(3)
# 登录
result = await client.login("admin", "123")
print("登录结果:", result)
# 发送请求
await client.request_payload("user.info", {})
print("已发送请求,等待响应...")
# 等待一段时间以接收响应
await asyncio.sleep(5)
# 关闭连接
await client.close()
# 运行异步主函数
asyncio.run(main())
参考
| 类名 | 方法名 | 简介 |
|---|---|---|
| FnosClient | __init__ |
初始化客户端 |
| FnosClient | connect |
连接到WebSocket服务器 |
| FnosClient | login |
用户登录方法 |
| FnosClient | get_decrypted_secret |
获取解密后的secret |
| FnosClient | on_message |
设置消息回调函数 |
| FnosClient | request |
发送请求 |
| FnosClient | request_payload |
以payload为主体发送请求 |
| FnosClient | request_payload_with_response |
以payload为主体发送请求并返回响应 |
| FnosClient | close |
关闭WebSocket连接 |
| Store | __init__ |
初始化Store类 |
| Store | general |
请求存储通用信息 |
| ResourceMonitor | __init__ |
初始化ResourceMonitor类 |
| ResourceMonitor | cpu |
请求CPU资源监控信息 |
| ResourceMonitor | gpu |
请求GPU资源监控信息 |
| ResourceMonitor | memory |
请求内存资源监控信息 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fnos-0.2.0.tar.gz
(11.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
fnos-0.2.0-py3-none-any.whl
(12.0 kB
view details)
File details
Details for the file fnos-0.2.0.tar.gz.
File metadata
- Download URL: fnos-0.2.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b3c7c044b16a0054a725bf13a2592e9ffde0191d4ade55551ce24b814536909
|
|
| MD5 |
0c9b11fb6cd6fb911d0bc4d0ca3d355a
|
|
| BLAKE2b-256 |
4e97d4645a518407191a05957490b7c888917eb99d05f1f910539dfaf5240922
|
File details
Details for the file fnos-0.2.0-py3-none-any.whl.
File metadata
- Download URL: fnos-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8caa7e3244f9fbdd74a0a08c80982d49e847fef96c2f971c7af805ff4de765fb
|
|
| MD5 |
6285c1838720a504ebe84ea82c56f998
|
|
| BLAKE2b-256 |
8521abe6c45acf7a9ebb5316636105192e27dbd75ea80524ab80f9b4206ae4d9
|