Beispiel #1
0
def list_shared(api: BaiduPCSApi, show_all=True):
    page = 1
    while True:
        shared_links = api.list_shared(page=page)
        if not shared_links:
            break

        page += 1

        for sl in shared_links:
            if sl.has_password():
                assert sl.share_id
                pwd = api.shared_password(sl.share_id)
                sl = sl._replace(password=pwd)

            if show_all or sl.available():
                display_shared_links(sl)
Beispiel #2
0
def list_shared(api: BaiduPCSApi, page: int = 1, show_all=True):
    _shared_links = api.list_shared(page=page)
    if not _shared_links:
        return

    shared_links = []
    for sl in _shared_links:
        if sl.has_password():
            assert sl.share_id
            pwd = api.shared_password(sl.share_id)
            sl = sl._replace(password=pwd)

        if show_all:
            shared_links.append(sl)
            continue

        if sl.available():
            shared_links.append(sl)
    display_shared_links(*shared_links)
Beispiel #3
0
def share_files(api: BaiduPCSApi, *remotepaths: str, password: Optional[str] = None):
    shared_link = api.share(*remotepaths, password=password)
    display_shared_links(shared_link)