We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.

Forum Discussion

ms97's avatar
ms97
Explorer | Level 3
11 months ago

I want to save a file outside of the Apps folder

Hello!
I am currently saving files in my 'Apps' folder using the files_upload() API. I want to save files in a seperate environment than 'Apps' where users are already looking. I believe my Dropbox key has permission to do this, but I cannot figure out the path settings to get this to integrate correctly.

 

folder = 'testing'
        filename = 'test_12_28_23'
        path = '/AccountingCloseoutFiles/' + folder + '/' + filename
        myRange = np.arange(1,1001,1)
        df = pd.DataFrame({"numbers": myRange})
        try:
             with io.BytesIO() as stream:
                with pd.ExcelWriter(stream) as writer:
                    df.to_excel(writer, sheet_name='test',
                                    index=False)
                stream.seek(0)
                dbx.files_upload(stream.getvalue(),
                                 path,
                                 mode=dropbox.files.WriteMode.overwrite)
        except Exception as e:
            logger.critical('File was unable to be saved to dropbox.')
            logger.critical(f'Error: {e}')
            sys.exit(1)

 

This code works, but it stores data in 'Apps' instead of the 'AccoutingCloseoutFiles' parent folder that I want it in.

 

Any help is appreciated! 

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    Hi ms97,

    No, your application doesn't have such permission. You have limited your application permission to access (not only save) files and/or folders within app specific folder only and nothing outside. That's your choice! As seems, this choice is unintentional. You need full access application, not app' folder type! Unfortunately, such permission cannot get changed (unlike other permissions, like scopes, for instance). You need to recreate your application and select correct application type at creation moment (as noted, later cannot change).

    Hope this helps.

    • ms97's avatar
      ms97
      Explorer | Level 3

      Thank you for the information! My app has full Dropbox access already, but no matter what path I give it, it is stored in the App folder.  I have two apps one is limited to 'App folder' and one is not.  When using bi_automation, it still only stores files inside the app folder. Is there a way to change this?

      • Здравко's avatar
        Здравко
        Legendary | Level 20

        ms97 wrote:

        ...  When using bi_automation, it still only stores files inside the app folder. ...


        What do you mean when you say "using bi_automation"? 🤔 Did you change only the app key only and continue use the existing tokens or perform full re-authentication? 🙂

About Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,875 PostsLatest Activity: 3 hours ago
323 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!