A collection of reusable python core library from AI Lingues.
Project description
ailingues-core
ailingues-core 是由 AI Lingues 开发的 Python 核心工具库,提供了一套完整、可靠、跨平台的基础组件,涵盖网络请求、系统信息、消息队列、安全加密、日志管理等常用功能。旨在帮助开发者快速构建稳定的 Python 应用程序。
注意:
本项目原名Pycorelibs,自 0.3.3 版本起更名为ailingues-core。
注意:
本项目原名Pycorelibs,自 0.3.3 版本起更名为ailingues_core。
✨ 核心特性
- 🌐 网络工具 - 强化版 HTTP 请求(支持重试、代理、SSL)、网页搜索、文件上传
- 💻 系统信息 - 跨平台获取 CPU、主板、显示器、网卡、操作系统等硬件信息
- 🔐 安全加密 - RSA/AES 混合加密、数字签名、硬件指纹、MD5/Base64 工具
- 📝 日志管理 - 支持日志切割(按时间/大小)、多级别输出、彩色终端
- 🛠️ 实用工具 - 配置管理、文件操作、字符串处理等常用辅助函数
📦 安装
使用 pip 安装(推荐)
pip install ailingues-core
从源码安装
不支持
依赖要求
- Python >= 3.11
🚀 快速开始
1. 网络请求
from ailingues_core.network.requests import fetch_url, HTTPMethod
# 同步请求
resp = fetch_url(
url="https://api.github.com/repos/python/cpython",
method=HTTPMethod.GET,
timeout=10,
max_retries=3
)
if resp["success"]:
print("响应内容:", resp["content"])
else:
print("请求失败:", resp["error"])
2. 系统信息获取
from ailingues_core.system.inspector import SystemInfo
# 获取完整系统硬件指纹
info = SystemInfo().get_data()
print(f"操作系统: {info['os']['system']}")
print(f"CPU: {info['cpu']['brand_raw']}")
print(f"主 MAC: {info.get('primary_mac')}")
3. 加密与签名
from ailingues_core.security.cryptographys import AsymmetricCrypto
# 生成密钥对
priv, pub = AsymmetricCrypto.generate_keypair(key_size=2048)
# 加密
message = b"Secret data"
encrypted = AsymmetricCrypto.encrypt(message, pub)
# 解密
decrypted = AsymmetricCrypto.decrypt(encrypted, priv)
assert decrypted == message
# 签名
signature = AsymmetricCrypto.sign(message, priv)
# 验签
is_valid = AsymmetricCrypto.verify(message, signature, pub)
print(f"签名验证: {is_valid}")
4. 日志管理
from ailingues_core.utils.logger import Logger
# 创建日志器(支持按大小或时间切割)
logger = Logger(
log_dir="./logs",
filename_prefix="myapp",
level_console=Logger.INFO,
rotation_mode="size",
rotation_size=10 * 1024 * 1024 # 10MB
)
logger.info("应用启动")
logger.warning("这是一条警告")
logger.error("发生错误")
📚 模块说明
🌐 Network(网络)
| 模块 | 功能 | 文档 |
|---|---|---|
requests |
强化版 HTTP 请求(支持重试、代理、SSL) | network.md |
upload |
文件上传处理(支持大小限制、哈希校验) | network.md |
💻 System(系统)
| 模块 | 功能 | 文档 |
|---|---|---|
cpu |
CPU 信息获取 | system.md |
mainboard |
主板/BIOS/UUID 信息 | system.md |
monitors |
显示器信息(分辨率、坐标) | system.md |
netadapter |
网卡信息(MAC、IP、状态) | system.md |
osinfo |
操作系统基本信息 | system.md |
runtime |
系统启动时间、运行时长 | system.md |
inspector |
系统硬件指纹聚合 | system.md |
🔐 Security(安全)
| 模块 | 功能 | 文档 |
|---|---|---|
cryptographys |
RSA/AES 混合加密、数字签名 | security.md |
fingerprints |
硬件指纹生成 | security.md |
md5s |
MD5 哈希计算 | security.md |
base64s |
Base64 编解码 | security.md |
🛠️ Utils(工具)
| 模块 | 功能 | 文档 |
|---|---|---|
archive_io |
压缩解压(支持文件、目录和二进制流) | archiveio.md |
logger |
日志管理(支持切割) | logger.md |
config |
配置文件管理 | config.md |
files |
文件信息与统计 | files.md |
file_operations |
文本文件合并与拆分 | file_operations.md |
filetype_detector |
文件类型检测 | filetype_detector.md |
strings |
字符串处理工具 | strings.md |
📖 完整文档
详细的 API 文档请查看 docs 目录:
🏗️ 项目结构
ailingues_core/
├── ailingues_core/ # 源代码
│ ├── network/ # 网络模块
│ ├── system/ # 系统信息模块
│ ├── security/ # 安全加密模块
│ └── utils/ # 工具模块
├── docs/ # API 文档
├── test/ # 单元测试
├── pyproject.toml # 项目配置
├── requirements.txt # 依赖列表
└── README.md # 本文件
📝 许可证与使用条款
软件包使用许可
ailingues-core 软件包(通过 pip 安装的二进制包)采用 MIT License 开源协议:
- ✅ 自由使用 - 可在个人项目、企业项目中自由使用
- ✅ 商业用途 - 允许用于商业产品和服务
- ✅ 自由分发 - 可自由分发和再分发软件包
- ✅ 无使用限制 - 无需支付任何费用或获得额外授权
源代码保护条款
重要声明:本项目的 源代码为私有财产,受知识产权法保护:
- ❌ 不公开源代码 - 源代码不对外公开
- ❌ 禁止逆向工程 - 严禁对软件包进行反编译、逆向工程或反汇编
- ❌ 禁止源码分发 - 不得以任何形式获取、复制或分发源代码
- ❌ 禁止修改重发布 - 不得修改软件包后重新发布
简而言之:您可以自由使用我们的软件包(包括商业用途),但请尊重我们的源代码知识产权。
📧 联系我们
- 官网: https://www.ailingues.com
- 邮箱: support@ailingues.com
- 技术支持: 如有问题或建议,请通过邮箱联系我们
Made with ❤️ by AI Lingues Team
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 Distributions
Built Distributions
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 ailingues_core-0.3.4-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: ailingues_core-0.3.4-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
128f9b92d2da744e6f486e099fe7031e213c624ece2849fae3c1752aaa9e505f
|
|
| MD5 |
bc00ac0cc9a6ff395c3b9f4e20cf6a36
|
|
| BLAKE2b-256 |
8755bb881bfe75df91b8d190153fc94008e21d7bd50229f383dc63e236e2df91
|
File details
Details for the file ailingues_core-0.3.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: ailingues_core-0.3.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 8.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15c8766aeff33377c2996b9154670740bcebdcb29052f7648fbe5245e87cf83f
|
|
| MD5 |
f64d10198447fd7cacad75e3c5aa300a
|
|
| BLAKE2b-256 |
99efde38bbb7cc2788f66a6ab448bb4e9f4dc73e97e621ca88b08a61d167998b
|