Beispiel #1
0
def test_file_link_ok():
    link = api.file_link('xsxy0Io3Qg')
    assert link == (
        "http://vip.3.dl.webshare.cz/0029/xsxy0Io3Qg/300000/eyJhZGRyIjoiODku"
        "MTAyLjMxLjE5IiwidmFsaWRfdG8iOjE1MDkyNzY3NzcsInVzZXJfaWQiOm51bGwsImZy"
        "ZWUiOjF9/a85a2ad2a4ca592b9d9a70ce634c6874/Linux-Ubuntu-12.10---"
        "Quantal-Quetzal-x64.iso")
Beispiel #2
0
def get_link(args):
    try:
        data = api.file_link(args.id, ignore_vip=args.ignore_vip)
    except api.LinkUnavailableException as exc:
        print(f'{T.red}{exc}{T.normal}', file=sys.stderr)
        sys.exit(1)
    print(data)
Beispiel #3
0
def _get_link(files, query=None, ignore_vip=False):
    """Get first available link from list of file candidates."""
    for file_ in files:
        try:
            link = api.file_link(file_.ident, ignore_vip=ignore_vip)
        except api.LinkUnavailableException:
            if query is not None:
                print(f'{query} {T.yellow}SKIP{T.normal}: {file_.name}',
                      file=sys.stderr)
            continue
        else:
            return link, file_
    return None, None
Beispiel #4
0
def _get_link(files, query=None):
    """Get first available link from list of file candidates."""
    for file_ in files:
        try:
            link = api.file_link(file_.ident)
        except api.LinkUnavailableException:
            if query is not None:
                print('{query} SKIP: {name}'.format(query=query,
                                                    name=file_.name),
                      file=sys.stderr)
            continue
        else:
            return link, file_
    return None, None
Beispiel #5
0
def test_file_link_not_found():
    with pytest.raises(api.LinkUnavailableException):
        api.file_link('xxxxxxxxx')
Beispiel #6
0
def get_link(args):
    data = api.file_link(args.id)
    print(data)