https://www.dropbox.com/developers/core/docs/python#DropboxClient.share
The Dropbox API doesn't currently offer a way to set a custom expiration on shared links, but I'll be sure to pass this along as a feature request.
what about setting the password on shared links ?
That's also not currently available, but I'll pass that along as a request as well.
Is there any expected/known timeline for this?
Thanks!
This is now possible using the /sharing/create_shared_link_with_settings endpoint on API v2:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-create_shared_link_with_settings
In the latest version of the Python SDK, that's the sharing_create_shared_link_with_settings method:
https://dropbox-sdk-python.readthedocs.org/en/master/moduledoc.html#dropbox.dropbox.Dropbox.sharing_create_shared_link_with_settings
Oh! great, I was looking at v1 docs. Thank you very much!
sorry to revive this, but can someone show an example of how to pass settings here? Like:
dbx = dropbox.Dropbox("KEY")dbx.users_get_current_account()print dbx.sharing_create_shared_link_with_settings('link/to/share', ????)
I'm not sure how to pass the settings, like requested_visibility or link_password.
Sure, this creates a shared link for a file and also supplies a requested visibility and expiration in the settings:
import datetimeimport dropboxdbx = dropbox.Dropbox("<ACCESS_TOKEN>")expires = datetime.datetime.now() + datetime.timedelta(days=30)requested_visibility = dropbox.sharing.RequestedVisibility.team_onlydesired_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.
The dropbox.sharing.SharedLinkSettings constructor also takes a link_password parameter.
okay that's great. thank you so much. that really put that in perspective!