Beispiel #1
0
def get_aria2():
    try:
        p = PyAria2(host=GetConfig('ARIA2_HOST'),
                    port=GetConfig('ARIA2_PORT'),
                    secret=GetConfig('ARIA2_SECRET'),
                    scheme=GetConfig('ARIA2_SCHEME'))
        info = json.loads(p.getSessionInfo())[0]
        if info.get('error'):
            msg = info.get('error').get('message')
            if msg == 'Unauthorized':
                msg = 'Aria2未验证!请检查Aria2信息!'
            return msg, False
        return p, True
    except Exception as e:
        return e, False
Beispiel #2
0
def get_aria2():
    try:
        p=PyAria2()
        return p,True
    except Exception as e:
        return e,False