@@ -0,0 +1,1747 @@
+import os%0Aimport requests%0Afrom time import time%0Afrom typing import Iterator%0A%0Aimport dropbox%0A%0A%0Adef t():%0A    %22%22%22Return string of elapsed time since start in seconds.%22%22%22%0A    return '%7B:.2f%7D:'.format(time() - start)%0A%0A%0Adef list_files(token: str,%0A               member_id: str) -%3E Iterator%5Bdropbox.files.Metadata%5D:%0A    %22%22%22Recursively walk the folder tree, yielding files.%22%22%22%0A    headers = %7B'Authorization': 'Bearer ' + token,%0A               'Dropbox-API-Select-User': member_id%7D%0A    list_folder = 'https://api.dropboxapi.com/2/files/list_folder'%0A    list_folder_continue = 'https://api.dropboxapi.com/2/files/list_folder/continue'%0A    post_data = %7B'path': '', 'recursive': True%7D%0A%0A    print(f'Requesting %7Blist_folder%7D with %7Bpost_data%7D')%0A    r = requests.post(list_folder, headers=headers, json=post_data)%0A    r.raise_for_status()%0A    response = r.json()%0A%0A    for entry in response%5B'entries'%5D:%0A        yield entry%0A%0A    post_data = %7B'cursor': response%5B'cursor'%5D%7D%0A    has_more = response%5B'has_more'%5D%0A%0A    while has_more:%0A        print(f'Requesting %7Blist_folder_continue%7D')%0A        r = requests.post(list_folder_continue, headers=headers,%0A                          json=post_data)%0A        r.raise_for_status()%0A        response = r.json()%0A%0A        for entry in response%5B'entries'%5D:%0A            yield entry%0A%0A        post_data%5B'cursor'%5D = response%5B'cursor'%5D%0A        has_more = response%5B'has_more'%5D%0A%0A%0Astart = time()%0Atoken = os.environ%5B'DROPBOX_TEAM_TOKEN'%5D%0Ateam = dropbox.DropboxTeam(token)%0Amembers_list = team.team_members_list()%0A%0A# Get the first member%0Amember = members_list.members%5B0%5D%0A%0Aprint(t(), 'Listing files for', member.profile.name.display_name)%0A%0Afor entry in list_files(token, member.profile.team_member_id):%0A    print('Found ' + entry%5B'path_display'%5D)%0A

Test for using HTTP API for recusive folder listing