Skip to main content

个人常用功能封装

Project description

common tool library for silvaq

silvaq-pylib

我自己常用的功能封装起来,方便自己日常使用

  • version 0.1.5 :
    • 新增了日期常规方法

工具库

  1. file 文件相关
  2. dir 目录相关
  3. time 日期、时间相关
  4. mail 发送邮件相关
  5. logger 日志相关

安装

pip3 install silvaq-pylib

更新

pip3 install  --upgrade silvaq-pylib

使用

from silvaq_libs import file as silva_file
from silvaq_libs import dir as silva_dir
from silvaq_libs.mail import Server as SilvaMailServer
from silvaq_libs.logger  import Logger as SilvaLogger

if __name__ == '__main__':

    # for files
    silva_file.exist("/tmp/test.txt")

    #for dir 
    silva_dir.maketree("a/b/c/d")

    # for mail
    params_dict = {
        'host': "server_host",
        'sender': "sender",
        'password': "password",
        'username': 'username',
        'port': 25,
    }
    to="somebody"
    sub="somesub"
    con="somecon"
    SilvaMailServer(**params_dict).send_mail(to,sub,con)

    #for logger
    logger = SilvaLogger("log_path","log_file_prefix","log_file_suffix","halder_container_cap")
    logger.log("some con")
    logger.log("some con again")
    # ... more log here
    # notice  目前所有配置都是默认项,所以日志是实时写入的,如果有需求想用缓冲请自行查阅并修改创建hander时open 的buffer
    # todo 这一项将提供可选方法
    logger.commit() 

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

silvaq-lib-0.1.5.tar.gz (8.0 kB view hashes)

Uploaded Source

Built Distribution

silvaq_lib-0.1.5-py3-none-any.whl (9.1 kB view hashes)

Uploaded Python 3

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