static.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:wat-bridge 作者: rmed 项目源码 文件源码
def init_bridge():
    """Parse the configuration file and set relevant variables."""
    conf_path = os.path.abspath(os.getenv('WAT_CONF', ''))

    if not conf_path or not os.path.isfile(conf_path):
        sys.exit('Could not find configuration file')

    parser = configparser.ConfigParser()
    parser.read(conf_path)

    # Whatsapp settings
    SETTINGS['wa_phone'] = parser.get('wa', 'phone')
    SETTINGS['wa_password'] = parser.get('wa', 'password')

    # Telegram settings
    SETTINGS['owner'] = parser.getint('tg', 'owner')
    SETTINGS['tg_token'] = parser.get('tg', 'token')

    # TinyDB
    global DB
    DB = TinyDB(parser.get('db', 'path'))
    DB.table_class = SmartCacheTable
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号