Last active
July 3, 2023 13:18
-
-
Save jmyzk/6ca64ccf5ad8531e3cea98d0fb32df58 to your computer and use it in GitHub Desktop.
Example snippet to get url_id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dbx = dropbox.Dropbox(access_token) | |
folder_path = "/path/to/folder" | |
try: | |
result = dbx.files_list_folder(folder_path) | |
for entry in result.entries: | |
if isinstance(entry, dropbox.files.FileMetadata): | |
file_name = entry.name | |
url_id = entry.id.split(":")[1] # Extract the URL ID | |
file_url = f"https://www.dropbox.com/s/{url_id}/{file_name}" | |
print(f"File: {file_name}\nURL: {file_url}\n") | |
except AuthError as e: | |
print(f"Error connecting to Dropbox API: {e}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment