Skip to main content

Python爬虫脚本管理器 - Web界面 + 命令行

Project description

🕷️ SpiderWei Manager

Python爬虫脚本管理器 - 支持 Web 界面、后台守护进程、命令行工具和 Python 库调用

✨ 主要特性

  • 🌐 Web界面 - 现代化的Web管理界面,支持远程访问
  • 📦 Python库 - 可集成到其他项目中
  • ⚙️ 命令行工具 - 支持自动化脚本
  • 🧩 后台守护进程 - 无界面运行任务调度器
  • 📊 实时日志 - WebSocket实时日志推送
  • 🔔 飞书告警 - 脚本失败自动推送告警
  • 🔄 自动重启 - 失败自动重启,支持退避策略
  • 📝 日志轮转 - 自动日志轮转和过期清理
  • 🚀 远程上传 - Web界面支持上传脚本文件
  • ✏️ 在线编辑 - Web界面支持查看、编辑、备份和恢复脚本内容

🚀 快速开始

安装

# 克隆项目
git clone https://github.com/spiderwei/spider-manager.git
cd spider-manager

# 基础安装
pip install -e .

# 或者安装Web支持
pip install -e .[web]

# 或者安装开发依赖
pip install -e .[dev]

启动方式

1. Web界面 (推荐)

spiderWei_manager web

然后在浏览器打开 http://localhost:8194

也可以指定监听地址、端口或开发模式:

spiderWei_manager web --host 127.0.0.1 --port 8194 --reload

2. 后台守护进程

无界面启动任务调度器,适合服务器长期运行:

spiderWei_manager daemon

3. 命令行管理

# 添加脚本
spiderWei_manager add spider.py --schedule loop --interval 3600

# 列出任务
spiderWei_manager list

# 删除任务
spiderWei_manager remove my_spider

# 查看配置
spiderWei_manager config

# 查看任务日志
spiderWei_manager logs my_spider --lines 100

# 前台运行单个任务
spiderWei_manager run my_spider

4. 作为Python库使用

from spiderWei_manager import SpiderManager, Task
from datetime import datetime

manager = SpiderManager()

task = Task(
    name="my_spider",
    path="./spider.py",
    schedule_type="循环",
    interval=3600,
    next_run_time=datetime.now()
)

manager.add_task(task)
manager.start_scheduler()

📖 详细文档

查看 USAGE.md 了解完整使用说明

🎯 使用场景

  • 🕷️ 管理多个爬虫脚本的定时执行
  • 📊 数据采集任务的集中调度
  • 🤖 自动化测试脚本管理
  • 📈 定时数据处理任务
  • 🔄 需要故障自动恢复的长期任务

📂 项目结构

spiderwei-manager/
├── spiderWei_manager/      # 主包
│   ├── core/              # 核心模块(无UI依赖)
│   │   ├── config.py     # 配置管理
│   │   ├── task.py       # 任务模型
│   │   ├── logger.py     # 日志管理
│   │   ├── notifier.py   # 飞书告警
│   │   └── manager.py    # 核心管理器
│   ├── ui/                # UI层
│   │   └── web/          # Web界面
│   └── cli/               # 命令行工具
├── setup.py               # 打包配置
└── requirements*.txt      # 依赖文件

🔧 开发

# 安装开发依赖
pip install -e .[dev]

# 运行测试
pytest

# 代码格式化
black spiderWei_manager

📝 配置文件

配置文件位于当前工作目录:

  • settings.json - 全局设置
  • scripts.json - 任务配置

🌟 功能对比

功能 Web界面 CLI/Daemon Python库
任务管理
远程访问
上传脚本
下载脚本
在线编辑
编辑备份/恢复
实时日志 ✅(回调)
历史日志查询
飞书告警
自动重启
循环调度
每天定时
移动端访问

当前代码中没有 Qt 桌面界面和 spiderWei_manager qt 命令;如需桌面端,需要另行实现或恢复对应模块。

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 许可证

MIT License

👤 作者

SpiderWei


⚡ 提示: 首次使用建议先用 spiderWei_manager config 查看配置,然后用 spiderWei_manager add 添加一个测试脚本。

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

spiderwei_manager-1.0.0.tar.gz (45.9 kB view details)

Uploaded Source

Built Distribution

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

spiderwei_manager-1.0.0-py3-none-any.whl (48.5 kB view details)

Uploaded Python 3

File details

Details for the file spiderwei_manager-1.0.0.tar.gz.

File metadata

  • Download URL: spiderwei_manager-1.0.0.tar.gz
  • Upload date:
  • Size: 45.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for spiderwei_manager-1.0.0.tar.gz
Algorithm Hash digest
SHA256 53ce300203f13fa35cc3201a00cbf69bb129fd937a4c4a0bad014b3ab4257771
MD5 5008895ba5ef26f56709a64fc1e0370a
BLAKE2b-256 9f49fcab639467a37836a89b2fefa6e49bbf3a57db8689d9829dd387f8960204

See more details on using hashes here.

File details

Details for the file spiderwei_manager-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spiderwei_manager-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22ceba077aeb93e2e33530a45a2698dce9cb4ad25dea2bc9a040a5e9cf3df8c3
MD5 a78eabcb02f91e55f28ebc7c7e9d9534
BLAKE2b-256 e7c40b84af682cbd0501988c43685c68ee083af5895a009773a3db366adbd265

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