Skip to main content

A pocwatchdog package for security monitoring

Project description

安装

使用 pip 安装 etool:

pip install etool

Speed

Speed 是一个测试网络、磁盘、内存、GPU性能的工具,可以测试网络速度、磁盘速度、内存速度、GPU性能。

使用

from etool import Speed

Speed.test_network_speed()
Speed.test_disk_speed()
Speed.test_memory_speed()
Speed.test_gpu_performance()
Speed.run_all_tests()

file_ud(开发中)

file_ud 是一个文件上传下载工具,可以上传下载文件。

使用

from etool import file_ud

file_ud(port=8900)

ScreenShare(目前仅兼容windows)

ScreenShare 是一个屏幕共享工具,可以共享屏幕。

使用

from etool import screen_share

screen_share(port=8900)

pocwatch

pocwatch 是一个跨平台的 Python 任务调度器,支持丰富的定时执行任务,甚至是嵌套,并通过邮件发送通知:包括代码的报错信息、文件、截图。

特性

  • 简单易用
  • 跨平台支持 (Windows, Linux, macOS)
  • 灵活的任务调度
  • 可配置的邮件通知 (成功和失败)
  • 自动 SMTP 服务器选择
  • 详细的错误报告

使用

  1. 导入 pocwatchdog 模块:
from etool import pocwatch
  1. 定义您的任务:
def your_task():
    print("任务执行中...")
  1. 运行任务调度器:
pocwatch(
    job=your_task, 
    schedule_time="08:00",
    sender=None,  # 缺省则不发送
    password=None,  # 缺省则不发送
    recipients=[],  # 缺省则不发送
    smtp_server='smtp.exmail.qq.com',  # 缺省值则自动选择
    smtp_port=465,  # 缺省值则自动选择
    smtp_ssl=True,  # 缺省值则自动选择

    success_subject="success",  # 缺省默认值 subject和body只填一个则会subject和body相同
    success_body="success",  # 缺省默认值

    failure_subject="failure",  # 缺省默认值 subject和body只填一个则会subject和body相同
    failure_body="task failure: error_message",  # 缺省默认值
)
  • schedule_time: 执行时间

如果是数字则默认单位是秒,每间隔schedule_time秒执行一次,例如120,则每2分钟执行一次。

如果是字符串则默认是时间点,请遵从HH:MM的格式,例如08:00,每天在这个时间点执行一次。

如果是列表,则默认是多个时间点,例如["08:00", "12:00", "16:00"],每天在这些时间点执行一次。

如果传入的是字典,则解析字典的键:

如果字典的键为数字,则默认是日期,对应字典的值遵从上方数字、字符串、列表的判断。

如果字典的键为字符串,则默认是星期几(以周一为例,支持的写法包括:1mondayMondayMONDAYmonmon.m,以此类推),对应字典的值遵从上方数字、字符串、列表的判断。

例如下面是1号的8点、2号的8点、12点、16点、3号每隔一个小时执行一次、每周一的8点执行一次。

schedule_time = {
    1: "08:00",
    2: ["08:00", "12:00", "16:00"],
    3: 216000,
    "1": "08:00",
}
  • sender: 发件人邮箱,如果不想发送邮件,则可以不配置。
  • password: 发件人邮箱密码,如果不想发送邮件,则可以不配置。
  • recipients: 收件人邮箱列表,如果不想发送邮件,则可以不配置。
  • smtp_server: SMTP服务器地址,缺省值则自动选择。
  • smtp_port: SMTP服务器端口,缺省值则自动选择。
  • smtp_ssl: 是否使用SSL,缺省值则自动选择。
  • success_subject: 任务成功时的邮件主题,subject和body只填一个则会subject和body相同
  • success_body: 任务成功时的邮件内容,subject和body只填一个则会subject和body相同
  • failure_subject: 任务失败时的邮件主题,subject和body只填一个则会subject和body相同
  • failure_body: 任务失败时的邮件内容,subject和body只填一个则会subject和body相同
from etool import pocwatch

def your_task():
    print("任务执行中...")

pocwatch(
    job=your_task, 
    schedule_time="08:00",
    sender='your_email@example.com',
    password='your_password',
    recipients=['recipient1@example.com', 'recipient2@example.com'],
    smtp_server='smtp.exmail.qq.com',
    smtp_port=465,
    smtp_ssl=True,
    success_subject="任务成功",
    success_body="任务已成功执行。",
    failure_subject="任务失败",
    failure_body="任务执行失败,错误信息:error_message",
)

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 Distribution

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

etool-0.0.1-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file etool-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: etool-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for etool-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9495b9eba4af405866e0e52abba7dc0297c6c77e7f947bbe32d59f93d7ce2408
MD5 1dc16dd3999ddc88550f8cc8b9231033
BLAKE2b-256 4e6d40f0df9415856e0eb5d78e07fc06a89f0c0c1c6ad0f92f73fced1dbe182f

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