buyfakett自用的工具包
Project description
tt_util
此项目是根据@buyfakett的python使用习惯自己封装打包的包
- yaml_util.py
yaml的各种封装方法,主要使用read_yaml方法,来读取配置,所有配置都放在启动文件同一目录的config文件夹下,传入的filename不需要加.yaml
- uuid_util.py
把uuid的第一个值提取出来,做一层文件夹,可以让oss上快速查询和把第一层文件夹给去掉
- svn_util.py
操作svn的各种封装方法,使用示例:
# 使用示例
svn_client = SVNClient(repo_url='svn://', working_copy_path='', username='',
password='')
checkout_output, checkout_error, checkout_code = svn_client.checkout()
logging.info(f'检出日志: {checkout_output}')
logging.error(f'检出错误: {checkout_error}')
logging.info(f'检出返回码: {checkout_code}')
update_output, update_error, update_code = svn_client.update()
logging.info(f'更新日志: {update_output}')
logging.error(f'更新错误: {update_error}')
logging.info(f'更新返回码: {update_code}')
add_output, add_error, add_code = svn_client.add("/app/temp/svn/nginx/2")
logging.info(f'增加日志: {add_output}')
logging.error(f'增加错误: {add_error}')
logging.info(f'增加返回码: {add_code}')
commit_output, commit_error, commit_code = svn_client.commit('Committing changes')
logging.info(f'提交日志: {commit_output}')
logging.error(f'提交错误: {commit_error}')
logging.info(f'提交返回码: {commit_code}')
- ssh_util.py
ssh到服务器的各种封装方法,使用示例:
host = ''
password = ''
ssh = SSHClient(host, password)
# 执行单行命令
result_single = ssh.execute_command('ls -l')
# 执行多行命令
commands = ['pwd', 'whoami']
result_multiple = ssh.execute_commands(commands)
# 上传并执行脚本
local_script_path = 'C:\\Users\\buyfakett\\Desktop\\1.sh'
remote_script_path = '/root/1.sh'
result_script = ssh.upload_and_execute_script(local_script_path, remote_script_path)
ssh.close()
- exec_shell.py
在当前运行的服务器上运行命令和在服务器上检测文件,使用示例:
exec_shell('mkdir /test')
check_file('/data', '1*')
- aes_util.py
aes非对称加密的各种封装方法,使用示例:
key = '12223'
data = 'hc刺激啊四神聪骄傲i'
encrypt = encrypt_aes(data, key)
print(encrypt)
print(decrypt_aes(encrypt, key))
- qiniu_util.py
七牛云oss封装,使用示例:
# 上传
qiniu = QiniuFunction()
ret, info = qiniu.upload_file(local_file, remote_file)
- check_domain.py
检测域名是否做了dns解析,使用示例:
if not check_domain(domain):
return resp_400()
else:
return resp_200()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tt_util-1.1.7.tar.gz
(8.7 kB
view details)
Built Distribution
tt_util-1.1.7-py3-none-any.whl
(10.2 kB
view details)
File details
Details for the file tt_util-1.1.7.tar.gz
.
File metadata
- Download URL: tt_util-1.1.7.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afe8143ac532438a416776655093819e0b8e8cfa0be6d572670882dae8466a9f |
|
MD5 | 145cfc8871a3fe099be987cef0d268ed |
|
BLAKE2b-256 | b902c3f26829cd3aeb30dbe5dc9f5e47627aba38ac2a9814c31d41143a5ddcaa |
File details
Details for the file tt_util-1.1.7-py3-none-any.whl
.
File metadata
- Download URL: tt_util-1.1.7-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fb6b4df41ef5ee8276b1aeb1d52d8f212abbb2b1ba65270fb3de7adc956942c |
|
MD5 | 8983ab55c339fd7583b24a9eb2d83cfd |
|
BLAKE2b-256 | 1c278c124d993b066b54f4898ec080b21e038522e444495491a9fe8d3a88d3ae |