Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
chunchk
8 years agoExplorer | Level 4
How do I make apiError as a string
Hello, I am new in here
I try to develop a script that can auto email a Dropbox link to someone
I am using .sharing_create_shared_link_with_settings to determine does the file had been shared or not
However, now I encounter a new python exception which is "not_found",
my situation is, now I have 2 python exceptions, "not_found" and "shared_link_already_exists"
my question is, how do I let python know that the exception is "not_found" or "shared_link_already_exists" , so I can code some actions depends on the different exception
2 Replies
- Greg-DB8 years ago
Dropbox Community Moderator
Here's an example of how you can tell apart different errors:
import dropbox from dropbox.exceptions import ApiError dbx = dropbox.Dropbox("<ACCESS_TOKEN>") try: print(dbx.sharing_create_shared_link_with_settings("/test222.txt")) except ApiError as err: if err.error.is_shared_link_already_exists(): print("Link already exists.") if err.error.is_path() and err.error.get_path().is_not_found(): print("File not found.") elif err.error.is_settings_error(): print(err.error.get_settings_error()) else: print(err) - chunchk8 years agoExplorer | Level 4
Oh~I see~!
Thank you for your help
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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!