This is a follow on from the other couple of articles I have posted recently about linking Pythonista and Dropbox together on your iOS devices.
The other posts are
- How I get my SQLite database onto to my iOS devices using Pythonista
- Backup Pythonista Scripts to Dropbox
The next one is how to pull you files from Dropbox. I like to write on Pythonista, but when it comes to comments and details around the script, I do wait until i can use a proper keyboard etc, and if I am at my desktop I do find it easier to change/edit the scripts on a machine with a full size keyboard . I have some scripts I use on my desktops (Windows and Mac) that I need to convert to work in Pythonista, system environments variables, shortcuts to files etc. This is easier and quicker for me anyway on the main machines.
Once I have completed all the edits then I can just run this script and pull it down on my iOS devices. This way I can easily keep the scripts in sync across my iPhone and iPad
The script is
import dropbox from dropboxlogin import get_client import webbrowser import os dropbox_client = get_client() path='My_Backups/Pythonista' downloads=dropbox_client.metadata(path) files=[] for item in downloads['contents']: files=(item['path']) print files download=dropbox_client.get_file_and_metadata(files) pyfile=os.path.basename(files) print pyfile out=open(pyfile,'w') download,metadata=dropbox_client.get_file_and_metadata(files) out.write(download.read()) out.close() print files
You can find these scripts all up on my Github.
I am always interested in your thoughts so if you have any comments or feedback then please feel free to add any comments, or you can mail me here.