Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
rf27
9 years agoNew member | Level 2
Generate links and passwords with Python
Hi, I am looking to generate shared links with individual passwords for a lot of folders in one directory in Dropbox. Could you please give me some starter code or point me to more information fo...
Greg-DB
Dropbox Community Moderator
9 years agoIf you're using Python, we recommend using the official Dropbox Python SDK. In that, you can use the sharing_create_shared_link_with_settings method to create a shared link for any file or folder. Here's an example of using that method:
import datetime
import dropbox
dbx = dropbox.Dropbox("<ACCESS_TOKEN>")
expires = datetime.datetime.now() + datetime.timedelta(days=30)
requested_visibility = dropbox.sharing.RequestedVisibility.team_only
desired_shared_link_settings = dropbox.sharing.SharedLinkSettings(requested_visibility=requested_visibility, expires=expires)
shared_link_metadata = dbx.sharing_create_shared_link_with_settings("/test.txt", settings=desired_shared_link_settings)
print(shared_link_metadata)
`<ACCESS_TOKEN>` should be replaced with the access token.
In your case, you'd want to use RequestedVisibility.password instead of team_only.
dbower
8 years agoNew member | Level 2
Most of the links in the above message no longer work. Is it possible to re-link the references, or delete the message?
- Greg-DB8 years ago
Dropbox Community Moderator
dbower Thanks for letting me know! I've updated my post to fix those issues.
- ShawnLyu8 years agoExplorer | Level 3Hi Greg, I've tried your code but got exception with the following message:
dropbox.exceptions.ApiError: ApiError('e41bbb442f5b1b4fb6288eb2aa37c87e', CreateSharedLinkWithSettingsError(u'settings_error', SharedLinkSettingsError(u'not_authorized', None))).
I've no clues what's the problem and could you help me with this?
Thanks!- Greg-DB8 years ago
Dropbox Community Moderator
ShawnLyu You can find more information about the SharedLinkSettingsError.not_authorized error in the documentation here:
In short, you'll get that if you try to use a setting that isn't available to the account for the access token you're using. Free accounts can't set link passwords or expirations, for example.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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, Facebook or Instagram.
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!