Reputation: 115
Having successfully run the 'Getting started with Core API for Python', I'm now attempting to print a file's shared link by doing:
def get_file_information(self, file_path):
file_info = client.DropboxClient(self.sess)
print file_info.share(file_path)
I've tried passing:
file_path = '/Users/augustoesteves/Dropbox/DSCN7334.mov'
file_path = '/Dropbox/DSCN7334.mov'
file_path = '/DSCN7334.mov'
But I always get:
dropbox.rest.ErrorResponse: [404] u"Path '/Users/augustoesteves/Dropbox/DSCN7334.mov' not found"
dropbox.rest.ErrorResponse: [404] u"Path 'Dropbox/DSCN7334.mov' not found"
dropbox.rest.ErrorResponse: [404] u"Path 'DSCN7334.mov' not found"
I must be doing something embarrassingly stupid, but I can't figure it out.
Upvotes: 0
Views: 778
Reputation: 40492
Dropbox expects the request url to be in the form: https://api.dropbox.com/1/shares/<root>/<path>
where root
is either dropbox
or sandbox
and path
if the file path. The share()
method of Python API constructs the request url in the form:
path = "/shares/%s%s" % (self.session.root, format_path(path))
self.session.root
is set depending on access_type
value passed to the session constructor:
self.root = 'sandbox' if access_type == 'app_folder' else 'dropbox'
So your 3rd url should be correct. Check your access_type
and path
. Try to construct full URL and send a request manually.
Upvotes: 2