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

mark2mark's avatar
mark2mark
Helpful | Level 7
7 years ago

multiple calls of `files_get_temporary_link`

Hello,   I just got stuck when trying to call  dbx.files_get_temporary_link(path)  multiple times in python. because I need to create a bunch of links for a dynamically fed input (different paths...
  • mark2mark's avatar
    mark2mark
    7 years ago

    Well, if you uncomment the second call, and hence have both ones running, it doesn’t work anymore at my side. With the exact code I posted before.
    Is that what you also tried, too? You said »both calls, each generating a unique link to the same file.« but it should be two different files. Just saying.

    Now that I wanted to create a simplified version of the code for you, this one actually works. It is very weird though, because it ain’t too different from my actual code. I’ll post the now working one here (maybe also as a refernece for others). But I still don’t understand why my other code doesn’t work.

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    
    import dropbox
    import os
    import traceback
    
    access_token = '*****'
    dbx = dropbox.Dropbox(access_token)
    
    def getTemporaryLink(dbx, folder, name):
    	path = '/%s/%s' % (folder, name)
    	try:
    		link = dbx.files_get_temporary_link(path)
    	except dropbox.exceptions.HttpError as err:
    		print '*** HTTP error', err
    		return None
    	return link
    
    products = ["One.zip", "Two.zip"]
    
    temporaryLinks = []
    for product in products:
    	x = getTemporaryLink(dbx, "myFolder", product)
    	temporaryLinks.append(x)
    
    for linkResult in temporaryLinks:
    	print linkResult.link

     

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,910 PostsLatest Activity: 4 days ago
333 Following

If 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!