Skip to main content

A collection of reusable python core library from AI Lingues.

Project description

ailingues_core

Python Version License Version

ailingues_core 是由 AI Lingues 开发的 Python 核心工具库,提供了一套完整、可靠、跨平台的基础组件,涵盖网络请求、系统信息、消息队列、安全加密、日志管理等常用功能。旨在帮助开发者快速构建稳定的 Python 应用程序。

注意: 本项目原名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 开源协议:

  • 自由使用 - 可在个人项目、企业项目中自由使用
  • 商业用途 - 允许用于商业产品和服务
  • 自由分发 - 可自由分发和再分发软件包
  • 无使用限制 - 无需支付任何费用或获得额外授权

源代码保护条款

重要声明:本项目的 源代码为私有财产,受知识产权法保护:

  • 不公开源代码 - 源代码不对外公开
  • 禁止逆向工程 - 严禁对软件包进行反编译、逆向工程或反汇编
  • 禁止源码分发 - 不得以任何形式获取、复制或分发源代码
  • 禁止修改重发布 - 不得修改软件包后重新发布

简而言之:您可以自由使用我们的软件包(包括商业用途),但请尊重我们的源代码知识产权。


📧 联系我们


Made with ❤️ by AI Lingues Team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ailingues_core-0.3.3-cp311-cp311-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.11Windows x86-64

ailingues_core-0.3.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (8.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file ailingues_core-0.3.3-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for ailingues_core-0.3.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a52ec0827c585ae652e6160896b4a399918438f72289cec5e2a7b433be7c363f
MD5 ee8942f4b993caa407a2e3c1e3d52cb6
BLAKE2b-256 7708fcc669772c5fd5bd1f204b325ce82b79cbabe96f63af97a56a216d17a851

See more details on using hashes here.

File details

Details for the file ailingues_core-0.3.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ailingues_core-0.3.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 073b7bfb90b7bcb00b3294165a8d03feb291b636434dc55c90349057cedff4bc
MD5 000a006a7abf769052e4704b12cdee4b
BLAKE2b-256 f8722f7b5f118407e0d91d18e4ed1d60574249d6e6afbbdf36b4f11e183b6468

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page