We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
ms97
2 years agoExplorer | Level 3
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!
6 Replies
- Здравко2 years agoLegendary | 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.
- Greg-DB2 years ago
Dropbox Community Moderator
ms97 Здравко is correct; you cannot change the access type ("app folder" versus "full Dropbox") on an existing app. You can find more information on access types here. You can register a new app with full Dropbox access here.
- ms972 years agoExplorer | 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?
- Здравко2 years agoLegendary | 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? 🙂
- ms972 years agoExplorer | Level 3
I did a full re authentification using a new app
- Greg-DB2 years ago
Dropbox Community Moderator
ms97 If you perform an upload using the Dropbox API and it is automatically rooted in the app folder, that means you are using an access token for the app for that app folder.
Registering and authorizing a new app with full Dropbox access won't change existing access tokens (or refresh tokens); existing access tokens (and refresh tokens) for the app folder app will continue to only have access to the app folder. To upload outside the app folder, you'd need to switch to using an access token for the full Dropbox app instead.
To address this, get an access token (and refresh token, if using) for the full Dropbox app, and update your app as needed to make sure that it is using an access token (and refresh token, if using) for the full Dropbox app in the creation of the 'dbx' object that you're using to perform the upload.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 9 months ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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!