server.py 文件源码

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

项目:sysdweb 作者: ogarcia 项目源码 文件源码
def get_service_journal(service, lines):
    if service in config.sections():
        if get_service_action(service, 'status')['status'] == 'not-found':
            return {'journal': 'not-found'}
        try:
            lines = int(lines)
        except Exception as e:
            response.status = 500
            return {'msg': '{}'.format(e)}
        unit = config.get(service, 'unit')
        journal = Journal(unit)
        return {'journal': journal.get_tail(lines)}
    else:
        response.status = 400
        return {'msg': 'Sorry, but \'{}\' is not defined in config.'.format(service)}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号