8cd27fcb19
The overall intent is to make it easier for third-party clients to implement incremental backups as simple function calls to the garminexport library, rather than executing the garminbackup.py script. Co-authored-by: Stanislav Khrapov <stanislav.khrapov@dbschenker.com>
30 lines
1.1 KiB
Python
Executable File
30 lines
1.1 KiB
Python
Executable File
#! /usr/bin/env python
|
|
"""This python script calls garminexport.garminbackup module with CLI parsed arguments
|
|
and performs (incremental) backups of activities for a given Garmin Connect account.
|
|
The activities are stored in a local directory on the user's computer.
|
|
The backups are incremental, meaning that only activities that aren't already
|
|
stored in the backup directory will be downloaded.
|
|
"""
|
|
import logging
|
|
|
|
from garminexport.cli import parse_args
|
|
from garminexport.incremental_backup import incremental_backup
|
|
from garminexport.logging_config import LOG_LEVELS
|
|
|
|
logging.basicConfig(level=logging.INFO, format="%(asctime)-15s [%(levelname)s] %(message)s")
|
|
log = logging.getLogger(__name__)
|
|
|
|
if __name__ == "__main__":
|
|
args = parse_args()
|
|
logging.root.setLevel(LOG_LEVELS[args.log_level])
|
|
|
|
try:
|
|
incremental_backup(username=args.username,
|
|
password=args.password,
|
|
backup_dir=args.backup_dir,
|
|
format=args.format,
|
|
max_retries=args.max_retries)
|
|
|
|
except Exception as e:
|
|
log.error(u"failed with exception: %s", str(e))
|