semvec/pypi-packages huggingface dataset:
otl 1.10.2
运维工具集
License: MIT

# **otl 工具集**
---
# 安装方式
```shell script
pip install otl
```
---

### 封装企业微信接口
```python
from otl.wechat.wechat_api import WechatApi

GLOBAL_WECHAR_CONFIG = {
        'NAME': 'xxx',

        #企业的id，在管理端->"我的企业" 可以看到
        'CORP_ID': '',

        #应用列表 可以配置多个应用
        'APP_LIST': {
            'warning_robot': {           #报警机器人
                'APP_ID': '',           #APPID
                'APP_SECRET': '',       #APP密钥
                'switch': 'on',          #是否开启
            },
        }
    }

if __name__ == '__main__':
    we = WechatApi(GLOBAL_WECHAR_CONFIG)
    status, res = we.apps['warning_robot'].send(
        msg_type='text',
        to_users_list=['xxx'],
        msg_string='xxx'
    )
    if not status:
        print(res)
```
### 封装mysql方法
```python
from otl.db import MysqlDbBase


class Db1(MysqlDbBase):
    host = '1.1.1.1'
    port = 3306
    user = 'test_user'
    password = 'test_pwd'
    db = 'test_db'

# 实例化
db1 = Db1()
# 查询操作 -> 返回数据: list
db1.query("select ***")
# 写入操作 -> 返回影响行数: int
db1.insert("insert into ***")
# 更新操作 -> 返回影响行数: int
db1.update("update ***")
# 删除操作 -> 返回影响行数: int
db1.delete("delete ***")
```

### 发送邮件
```python
# -*- coding: utf-8 -*-
from otl.email import EmailApi
CONFIG = {
    # 组 支持多个组
    'team1': {
        'name': '',         # 组名 即邮件主题
        'user': '',         # 发件人
        'password': '',     # 发件人密码
        'smtp': '',         # smtp服务器
        'port': 25,
        'to_list': ['aaa@aa.com'],      # 收件人列表
        'cc_list': []       # 抄送列表
    }
}

if __name__ == '__main__':
    ea = EmailApi(CONFIG).team1    # 组名
    # 添加文本
    ea.add_str('lalala')
    # 添加图片
    ea.add_image("/a/b/123.jpg")
    # 添加表格
    ea.add_table([['姓名', '年龄', '性别'], ['aaa', 25, '男'], ['ccc', 25, '男']])
    # 添加附件
    ea.add_attr("/a/b/wechat.tgz")
    status, res = ea.send_email()
    if status:
        print('success')
    else:
        print('error: {}'.format(res))

```
stream-tool 0.1.0
a simple tool for making macros
License: MIT
Requires Python: >=3.10,<4.0

# Stream Tool
**Stream Tool** is a simple tool for making macros!

Use Stream Tool to create macros to control OBS or other programs on your computer. Or literally to run any python code you want to on a button press.

There is currently built-in functionality to run control some basic parts of OBS and to send your own OBS websocket requests. Other functionality may be added in the future but the main feature is that a function can be created and attached to a button to run it.

Project documentation is hosted at Read the Docs [here](https://stream-tool.readthedocs.io).


## Installing Stream Tool

Stream Tool is available on PyPI:

```console
$ python -m pip install stream-tool
```

Stream Tool officially supports Python 3.10+.

## Documentation

Full public API documentation as well as several tutorial to get started are available at [Read the Docs](https://stream-tool.readthedocs.io). A quick start is available below to show you the jist of it.

## Quick Start

Import Stream Tool and necessary modules and functions:

```python
>>> from stream_tool import create_website, builtin_obs_actions, Websockets_Auth
```

Configure OBS websocket password, create a site, and add a page:

```python
>>> Websockets_Auth.websockets_password = "password"
>>> my_site = create_website(use_obs_websockets=True)
>>> my_page = my_site.add_page("page 1")
```

Add a button with a link to the index page:

```python
>>> btn_1 = my_page.add_button("index")
>>> btn_1.button_link =m y_site.index.url)
```

Add a button to increase a OBS input's volume: 

```python
>>> btn_2 = my_page.add_button("sound up")
>>> btn2.button_function = 
...     obs_websockets_actions.change_volume("input")
```

Run the webiste and visit it at the link:

```python
>>> my_site.build_and_run()
* Serving Flask app 'stream_tool._website'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
```