Home

Awesome

gwbackupy: Google Workspace™ backup and restore solution.

0.2.0 0.2.0 BSD-3-Clause black Coverage Status

What is it?

Gwbackupy is an open source Google Workspace™ backup and restore solution, written in python.

Currently supported Gmail messages and labels only.

Why?

Due to gmvault limitations:

Details

Paid plans are the following: here. Google One or additional storages are not considered as paid plans

Requirements

Install

The easiest way for installing:

pip install gwbackupy
# and run...
gwbackupy ...

or

# clone this repository
# install requirements
pip install -r requirements.txt
# and run...
python3 -m gwbackupy ...

The project also has an official Docker image: gwbackupy-docker - under development. The docker image has scheduled backup runs and also supports managing multiple email accounts.

Instructions

Usage

Example usage Gmail

Backup run in CLI:

gwbackupy \
  --service-account-key-filepath <service-acount-json-key-file> \
  --batch-size 5 \
  gmail backup \
  --email <mailbox email address>

Restore run in CLI:

gwbackupy \
  --service-account-key-filepath <service-acount-json-key-file> \
  --batch-size 5 \
  gmail restore \
  --add-label "backup-restore-1231" \
  --add-label "more-restore-label" \
  --filter-date-from <date or datetime eg. "2023-01-01"> \
  --filter-date-to <date or datetime eg. "2023-02-02 03:00:00"> \
  --restore-deleted \
  --email <source backup mailbox email address> \
  --to-email <destination mailbox email address> # If you want to a different destination account

Backup run from python code:

# WARNING: Calling directly from python code actively change in the current state of development.

from gwbackupy.gmail import Gmail
from gwbackupy.storage.file_storage import FileStorage
from gwbackupy.providers.gmail_service_provider import GmailServiceProvider
from gwbackupy.providers.gapi_gmail_service_wrapper import GapiGmailServiceWrapper

storage = FileStorage('./data/email@example.co')
service_provider = GmailServiceProvider(
    service_account_file_path='serviceacc.json',
    storage=storage,
)
service_wrapper = GapiGmailServiceWrapper()
gmail = Gmail(email='email@example.com',
              service_provider=service_provider,
              service_wrapper=service_wrapper,
              batch_size=3,
              storage=storage)
if gmail.backup():
    print('Yeah!')
else:
    print(':(')

Security

See SECURITY.md

Contributing

Welcome! I am happy that you want to make the project better.

Currently, there is no developed documentation for the process, in the meantime, please use issues and pull requests.

Changelog

The changes are contained in CHANGELOG.md.

About

Márton Somogyi