Making API calls to create the whole folder structure for the yard might sound like a lot of work, since there's a folder for every possible hiding place. One trick is to use /copy_ref. Rather than writing code to manually create each folder for each user who links their account, copy_ref lets you copy the contents from a pre-existing folder or file on another Dropbox account. It's much easier to manually create a custom folder hierarchy once, and then copy it many times. Plus, the cool thing about using a copy_ref on a folder is that it copies the whole thing—instant file tree!
It also uses
/delta to create a flat list of of folders in the Yard, which makes it easy to pick random hiding places for the eggs.
def enumerate_yard(path, client): cursor = None has_more = True paths = set() while has_more: response = client.delta(path_prefix=path, cursor=cursor) for path, metadata in response['entries']: paths.add(path) has_more = response['has_more'] return paths ... # Get flat list of paths to directories from '/Yard' flat_list = enumerate_yard('/Yard', client) # Choose 5 random places to hide eggs hiding_places = random.sample(flat_list, 5)