Forum Archive

Reference a file located in Dropbox using Python

zenimot

I want to use Python to get a random line from a text file located in Dropbox.
So far I have not been very successful, as I am not able to even open a file.

My question: How do I open a file located in Dropbox using Python?

ccc

Do you have https://gist.github.com/4034526 working already?

http://omz-forums.appspot.com/pythonista/post/6675908186341376

Once dropboxlogin is working, you can:

Use https://www.dropbox.com/developers/core/docs/python#DropboxClient.get_file

with client.get_file('/magnum-opus.txt') as in_file:
    the_data =  in_file.read()