A Python API wrapper for QingLong Panel
Project description
QLapi
QLapi 是一个用于青龙面板的 Python 异步 API 封装库。
安装
pip install QingLongTools
使用
import asyncio
from QLapi.ql import ql_api
from QLapi.ql_env import qlenv
from QLapi.ql_config import qlconfig
# 导入其他您需要使用的异步类
QL_HOST = "127.0.0.1"
QL_PORT = "5700"
CLIENT_ID = "CLIENT_ID"
CLIENT_SECRET = "CLIENT_SECRET"
async def main():
# 实例化 ql_api,使用异步工厂方法 create 和 async with 语句
# 确保 httpx 客户端在程序结束时自动关闭
ql_instance = await ql_api.create(
url=QL_HOST,
port=QL_PORT, # 您的面板端口
client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
async with ql_instance as ql:
# 示例:使用 qlenv 获取环境变量列表
ql_env_instance = qlenv(QL_HOST, QL_PORT, CLIENT_ID, CLIENT_SECRET)
ql_env_instance.s = ql.s # 共享同一个 httpx.AsyncClient 实例
envs = await ql_env_instance.search(search_value="651380741", name="MI_PAY_TOKEN")
print("环境变量搜索结果:", envs)
# 示例:使用 qlconfig 获取配置文件列表
ql_config_instance = qlconfig(QL_HOST, QL_PORT, CLIENT_ID, CLIENT_SECRET)
ql_config_instance.s = ql.s # 共享同一个 httpx.AsyncClient 实例
configs = await ql_config_instance.list()
print("配置文件列表:", configs)
# 示例:添加一个环境变量
add_result = await ql_env_instance.add("TEST_ENV", "test_value")
print("添加环境变量结果:", add_result)
if __name__ == "__main__":
asyncio.run(main())
模块
ql.py: 基础 API 认证和 HTTP 客户端。ql_config.py: 配置文件管理。ql_dependence.py: 依赖管理。ql_env.py: 环境变量管理。ql_log.py: 日志管理。ql_script.py: 脚本管理。ql_system.py: 系统信息和更新。ql_task.py: 定时任务管理。
贡献
欢迎贡献!请提交 Pull Request 或 Issues。
许可证
本项目使用 MIT 许可证。
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
qinglongtool-0.1.0.tar.gz
(6.5 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
File details
Details for the file qinglongtool-0.1.0.tar.gz.
File metadata
- Download URL: qinglongtool-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.10.8 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d01bf0b3a3165f04e0c39cf60fcc8ceae2408bff291d8faa9b49942bf93e761b
|
|
| MD5 |
aa36da9551c945956f104a857c1d4272
|
|
| BLAKE2b-256 |
30e46bd297ca73722d0e0a7e89c82a205217a0382e3593693474bbb13a76f2f9
|
File details
Details for the file qinglongtool-0.1.0-py3-none-any.whl.
File metadata
- Download URL: qinglongtool-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.10.8 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4faf25fe6a86e0124e44b7af18ee1eaa5dc735d081f856ce57dd7f3116936d8a
|
|
| MD5 |
666086232bf1cf7b11fd2dd3e580a5e6
|
|
| BLAKE2b-256 |
58a0338131db6a74bdbf929b64f7d6c85d5aa63b3f2a700693828f0dfe979405
|