Skip to content

Instantly share code, notes, and snippets.

@rjames86
Last active September 3, 2015 15:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjames86/79f857f427599f6e145c to your computer and use it in GitHub Desktop.
Save rjames86/79f857f427599f6e145c to your computer and use it in GitHub Desktop.
Backup Contacts.py
import contacts
import sys, os
import console
sys.path += [os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')]
from dropboxlogin import get_client
from datetime import datetime
# Update this path here for the backup
# location in your Dropbox account.
BACKUP_PATH = '/Backups/Contacts'
TODAY = datetime.today().strftime('%Y-%m-%d')
dropbox_client = get_client()
VCARD = "".join(person.vcard for person in contacts.get_all_people())
console.clear()
dropbox_client.put_file(BACKUP_PATH + '/contacts {}.vcf'.format(TODAY), VCARD)
print 'Backup complete!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment