Command-line utility which exports all of a user's Google Contacts in vCard/VCF format for backup (or portability)
Project description
Overview
Gcardvault is a command-line utility which exports all of a user's Google Contacts in vCard/VCF format for backup (or portability).
Features:
- Automatically discovers all of a user's contacts
- Downloads them in vCard/VCF format and saves them to disk for archival
- Optionally manages version history for each contact in an on-disk "vault" (a git repo under the covers)
- Can be run via Docker image (multi-arch) or installed directly as a Python package with command-line interface
How it works
- Uses Google's Identity Provider to authenticate (via OAuth2/OIDC)
- Uses Google's People API to discover a user's contacts
- Uses Google's CardDAV endpoints to download vCard/VCF contacts
- Uses GitPython to manage local git repo for version history under the covers
Usage
Some example commands...
Sync all contacts for foo.bar@gmail.com
user:
gcardvault sync foo.bar@gmail.com
Simply export contacts, do not save version history:
gcardvault sync foo.bar@gmail.com --export-only
See the CLI help for full usage and other notes.
Installation
Via Docker
docker run -it --rm \
-v ${HOME}/.gcardvault:/root/.gcardvault \
-v ${PWD}:/root/gcardvault \
rtomac/gcardvault sync foo.bar@gmail.com
Via PyPi
pip install gcardvault
gcardvault sync foo.bar@gmail.com
OAuth2 authentication
The CLI initiates an OAuth2 authentication the first time it is run (interactive), and then uses refresh tokens for subsequent runs (headless).
When you use Gcardvault in its default configuration, you are authenticating with Google using Gcardvault's client ID. There is nothing inherently insecure about this, since the application is running locally and therefore only you will have access to the data it reads from Google.
That said, it's strongly recommended to create your own client ID through the Google API Console, since the shared client ID will be used by others and subject to limits which may cause unpredictable failures.
rclone has a good write-up on making your own client ID.
You can provide your client ID and secret to gcardvault as follows:
gcardvault sync foo.bar@gmail.com --client-id my_client_id --client-secret my_client_secret
Development
Source repository:
http://github.com/rtomac/gcardvault
Install dependencies locally (for IDE)
make devenv
. ./.devenv/bin/activate
Build distribution and Docker image
make build
Build and test locally
make test
Build and run locally
make run user=foo.bar@gmail.com
Release to PyPi and Docker Hub
make release
See targets and variables in Makefile for more options.
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file gcardvault-1.0.0.tar.gz
.
File metadata
- Download URL: gcardvault-1.0.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31899fa986c9ef47fdd8c5510b4eacdb6782a26dbdd461e86ac06942e82ebcb3 |
|
MD5 | eac65b3d161cffca4ce537fba7ecc99a |
|
BLAKE2b-256 | 39d10d01890c6cdf6febbd309175049a7482fca0d3dfa64a1bbd3a7f37287cb2 |