栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

2021SC@SDUSC 山大智云 8.offine

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

2021SC@SDUSC 山大智云 8.offine

2021SC@SDUSC 山大智云 8.offine_download offine_download_settings.py

文件结构

__init__(self,config_file):初始化
parse_config(self,config_file):解析配置
def is_enabled(self):返回是否有文件下载功能
def __init__(self, config_file):
   self.enable_offline_download = False
   self.temp_dir = '/tmp/offline-download'
   self.max_workers = 10
# default 10
   self.time_limit = 30 * 60
# default 30 minutes

   self.session_cls = None
   self.seaf_session_cls = None

   self.parse_config(config_file)
def parse_config(self, config_file):
    try:
        cfg = ConfigParser()
        events_conf = config_file
        cfg.read(events_conf)
    except Exception as e:
        logger.error('Failed to read events config, disable offline download: %s', e)
        return

    conf = get_offline_download_conf(cfg)
    if not conf['enabled']:
        return

    try:
        self.session_cls = appconfig.session_cls
        self.seaf_session_cls = appconfig.seaf_session_cls
    except Exception as e:
        logger.warning('Failed to init db session class: %s', e)
        return

    self.enable_offline_download = True
    self.temp_dir = conf['tempdir']
    self.max_workers = conf['workers']
    # default 10
    self.time_limit = conf['time-limit']
def is_enabled(self):
    return self.enable_offline_download
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/581329.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号