Start 2025 on time and up to date. Seamlessly integrate your calendars into Dropbox with these simple steps.

Forum Discussion

johnhesler's avatar
johnhesler
New member | Level 2
3 years ago

Download other user dropbox file without my dropbox token

To download other user dropbox file i use

with open("rc.xlsx", "wb") as f:
    shared_link = "https://www.dropbox.com/s/xx/xx.xlsx?dl=0"
    metadata, res = dbx.sharing_get_shared_link_file(url=shared_link,link_password ='xxxx')
    f.write(res.content)

Even so this is not my file i still need mydropbox token to download it. Is it possible to avoid it ?

dbx = dropbox.Dropbox(mydropbox_token)

 

I also check this but can't acess the solution From https://www.dropbox.com/developers/documentation/python#tutorial

In order to make calls to the API, you'll need an instance of the Dropbox object. To instantiate, pass in the access token for the account you want to link.

  • Hi johnhesler,

    While you are talking for link access, it's possible. 😉 Link is something public and direct accessible. But you have done a mistake in your code. Take in mind that the same link can has different forms. The link you are using in your code is preview link (ends on '?dl=0'). So, it's NOT pointing to actual file, but a page to targeting preview the same  file! In this case you are downloading page's HTML code (did you check it 🙂). To download actual file your link should ends on '?dl=1'. That's it.

    Hope this helps.

     

    ADD: Actually you don't need to use any API calls (since you know link pointing actual file). Just download it!

     

    On other side using 'dbx.sharing_get_shared_link_file' requires user authentication. If you want use this method, then you need valid user authentication, despite doesn't matter who gets authenticated.