Skip to content

Open source Google Workspace™ backup solution written in python. (gmvault alternative)

License

Notifications You must be signed in to change notification settings

smartondev/gwbackupy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gwbackupy: Google Workspace™ backup and restore solution.

0.2.0 0.2.0 BSD-3-Clause

What is it?

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

Currently supported Gmail messages only.

Why?

Due to gmvault limitations:

  • is still abandoned (??)
  • authentication method is not usable in Google Workspace wide
  • designed only for gmail messages
  • only supports IMAP protocol (slow and limited speed)

Functionality

  • Run from CLI or run directly from python code

  • Authentication

    • OAUTH for free or paid plans (not recommended for paid plans)
    • Service account file (JSON or P12) for paid plans (can be configured to access all accounts in workspace.)
  • Version controlled storage for new and deleted items.

    Allows to restore specific moments without using an external snapshot system (eg. zips, file system with snapshot)

  • Dry mode (not write to local storage and not modify on server)

  • Uses API communication (no need for special IMAP and other settings)

  • Gmail

    • full backup (download all messages)

    • full backup continuously (periodically rerunning)

      Scanning the full mailbox, but download only the new messages and mark the deleted messages.

    • full restore to an empty mailbox (same or other account)

    • restore deleted message in specified interval

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

Requirements

  • pip or python3
  • Google Cloud account and own created access files. This software does not contain access files, this is for security reasons.

Install

The easiest way for installing:

pip install gwbackupy

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:

from gwb.gmail import Gmail
from gwb.storage.file_storage import FileStorage

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

Contributing

...

Changelog

The changes are contained in CHANGELOG.md.

About

Márton Somogyi

Sponsor this project

  •  
  •  

Packages

No packages published

Languages