Created
July 20, 2020 13:18
-
-
Save davesteele/03e6e30bf9e3ecae5c73dd9d7b560ed3 to your computer and use it in GitHub Desktop.
Synchronize Dropbox todo.txt on a Raspberry Pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/home/pi/virtualenvs/todo/bin/python | |
import dropbox | |
access_token = "" | |
dbx = dropbox.Dropbox(access_token) | |
dbx.files_download_to_file("/home/pi/Dropbox/todo/todo.txt", "/todo/todo.txt") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/home/pi/virtualenvs/todo/bin/python | |
# https://github.com/dropbox/dropbox-sdk-python | |
import dropbox | |
# https://github.com/davesteele/todo.txt-gtd | |
from tdtgtd.tdtbackup import backup_path | |
# can get access token directly from Dropbox app | |
access_token = "" | |
dbx = dropbox.Dropbox(access_token) | |
(md, res) = dbx.files_download("/todo/todo.txt") | |
path = backup_path("/todo/backup") | |
dbx.files_upload(res.content, path, mode=dropbox.files.WriteMode("overwrite", None)) | |
with open("/home/pi/Dropbox/todo/todo.txt", "rb") as fp: | |
data = fp.read() | |
dbx.files_upload(data, "/todo/todo.txt", mode=dropbox.files.WriteMode("overwrite", None)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment