Skip to main content

No project description provided

Project description

tiny-python-sdk

安装

$ pip install tiny-python-sdk

v1.0.0 以前版本为 intelab-python-sdk

FFmpeg常用工具(V0.6.0)

python运行ffmpeg命令执执行常用的视频处理命令,依赖系统安装的ffmpeg。

Linux::

sudo apt install ffmpeg

功能:

  • 视频流分片录制–ffmpeg_record.py

  • 拼接多个视频文件–ffmpeg_concat.py

  • 获取流地址的当前一帧–ffmpeg_capture.py

  • mp4转mp3–ffmpeg_mp4tomp3.py

  • 视频裁剪–ffmpeg_prune.py

CPU资源监控脚本(V0.5.0)

协助自己在服务器端监控进程的使用资源情况。每一秒打印一次。

Usage::

$ tiny_python_sdk ffmpeg PID CPU MEM MCPU 2243 0.1 0.1 0.1 tiny_python_sdk ffmpeg

钉钉群机器人信息发送(V0.4.0)

钉钉机器人是钉钉群的一个高级扩展功能, 目前自定义机器人支持文本(text)、链接(link)

官方文档参考

Usage:

>>> from tiny_python_sdk.dingtalk import DingTalkMessage
>>> dingtalk = DingTalkMessage(webhook, secret)
>>> dingtalk.send_text('这是文本信息', mobiles=['15131601294'], at_all=False)  # mobiles是at群中的人(手机号),at_all为True是at全体
>>> dingtalk.send_link('这是标题', '这是内容', 'https://www.baidu.com')
>>> dingtalk.send_markdown('这是标题', '# 这是内容 \n> 这是引用\n [百度](https://baidu.com)')

邮箱模块(V0.3.5)

对简单的邮件发送进行封装

Usage:

>>> from tiny_python_sdk.email import EMailMessage
>>> email = EMailMessage('w_angzhiwen@163.com', '发送者', 'xxxxx')  # 'xxxx' 用户密码
>>> msg = email.create(['zw.wang@ilabservice.com'], '你好,我是机器人', '无主题')  # 创建邮件内容
>>> msg = email.send(['zw.wang@ilabservice.com'], msg)  # 发送

logging 模块(V0.3.4)

日志格式:

时间 | 主机名 | 进程号 | 名称 | 级别 | 文件和行号 | 信息

Usage:

>>> from tiny_python_sdk.logger import log_init
>>> # 初始化配置
>>> log = log_init('test', debug=True, log_path='./logs')
>>> log.info('info')
2019-12-16T17:46:41.930061-+08:00 | wen-work-pc | 25689 | test | INFO    | root:<ipython-input-5-6a92ee17c096>:1 | info
>>> log.debug('debug')
2019-12-16T17:47:31.113047-+08:00 | wen-work-pc | 25689 | test | DEBUG   | root:<ipython-input-6-03b5a4252de9>:1 | debug
>>> log.error('error')
2019-12-16T17:48:02.338739-+08:00 | wen-work-pc | 25689 | test | ERROR   | root:<ipython-input-7-5bfd94e0c8ba>:1 | error

>>> import logging  # 其他文件中
>>> log1 = logging.getLogger()
>>> log1.info('info')
2019-12-16T17:46:41.930061-+08:00 | wen-work-pc | 25689 | test | INFO    | root:<ipython-input-6-d225ecf23612>:1 | info

说明:

  1. info日志输出到指定路径下的 log.info.{日期}

  2. error日志输出到指定路径下的 error.info.{日期}

  3. 日志文件每天零点切分

  4. 修复多进程下零点时切分出多个日志文件的Bug

log_init参数说明

TimedRotatingFileHandler的使用说明:

If backupCount is > 0, when rollover is done, no more than backupCount files are kept - the oldest ones are deleted.

缓存(0.3.0)

Usage:

>>> from tiny_python_sdk.cache import FileSystemCache
>>> from datetime import datetime
>>> cache = FileSystemCache('.cache')
>>> cache.set('12', datetime.now())
>>> cache.get('12')
datetime.datetime(2019, 12, 19, 12, 16, 1, 511077)
>>> list(cache.keys())
['12']
>>> cache.delete('12')

说明:

  1. 以key为文件名,存储python数据类型

更新历史

0.6.0

更新内容

  • 视频流分片录制

  • 拼接多个视频文件

  • 获取流地址的当前一帧

  • mp4转mp3

  • 视频裁剪

0.5.0

更新内容

  • 新增CPU资源监控脚本

0.4.0

更新内容

  • 新增对钉钉群机器人消息推送的接口封装,目前支持文本信息和链接

0.3.5

更新内容

  • 新增utils.get_host_ip()

  • 新增email,对简单的发送邮件进行封装

0.3.4

更新内容

  • 日志log_init新增使用参数

0.3.1

更新内容

  • 日志打印在一行,使用 | 区分。

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

tiny_python_sdk-1.0.1.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

tiny_python_sdk-1.0.1-py2.py3-none-any.whl (21.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tiny_python_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: tiny_python_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for tiny_python_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 060d604ed7fa6c7828ef122a58f15eb26adcda250d5b113b6dcb8424431252dc
MD5 1283ba233bff18392939e6b09237ff53
BLAKE2b-256 60ad79f10cf2af82b81027925090f7023a04e17ada4709322a700039f4d46971

See more details on using hashes here.

File details

Details for the file tiny_python_sdk-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for tiny_python_sdk-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4f5c76dd9efb0a7a6e82c571016a3abace760ac09241df76d1852ce3b7db7d7f
MD5 f6bf019fd78ad44f1067a9d4e365f632
BLAKE2b-256 82d0f460895f8c04ae02bb85b4b0e6ee25bdc249cac8e089389627e467f6be5b

See more details on using hashes here.

Supported by

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