You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
HADES
2 years agoHelpful | Level 5
Django integrate with Dropbox
Hello everyone I met an issue with the Dropbox access token when I generated it on the Dropbox console app and used it in setting.py like this.
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'Me...
- 2 years ago
Hi HADES,
Just keep in mind that no any real Dropbox API call can be seen in the code you shared. Another thing is that all access tokens are short lived, so wherever you perform actual API calls it's likely to fail after some time (typically 4 hours). For long term access you need refresh token. If a supported SDK is in use just proper initialization is enough (for the rest SDK takes care), otherwise tracing access token validity and refresh whenever needed should be performed.
Hope this gives direction.
Здравко
Legendary | Level 20
Hi HADES,
Glad to hear your upload is working already. 😉 Why do you use different path when you try get link? The path has to be the same one used on file upload or received on listing your containing folder. Don't assume something else, like what you see in your web browser or based on local Dropbox folder content! All paths for "App folder" app type are rooted in the app's automatically created own folder, not the entire account.
Hope this helps.
PS: In context of:
HADES wrote:... it still can not find my path ...
Evaluate the result of:
listRes = dbx.files_list_folder('')
... to see what you have there (in 'listRes'). 😉
HADES
12 months agoHelpful | Level 5
Thank you, I finally uploaded and got an image link to display for my application.
My code for someone who wants to store image and display them:
def upload_file(dbx, file, file_name):
with file.open('rb') as f:
dbx.files_upload(f.read(), f'/{file_name}')
# Get and create url of image
def get_and_share_image(dbx, file_name):
# Query all files to get file_name
all_files = dbx.files_list_folder('').entries
for file in all_files:
if isinstance(file, dropbox.files.FileMetadata) and file.name == file_name:
# Create avatar_url
generate_image_url = dbx.sharing_create_shared_link(file.path_lower)
image_url = generate_image_url.url
- Greg-DB12 months agoDropbox Staff
Please note that calling only files_list_folder is not guaranteed to return all of the items in the specified folder. You should use both files_list_folder and files_list_folder_continue to make sure you can retrieve all entries. Refer to the linked documentation for more information.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,882 PostsLatest Activity: 3 years agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!