Package: gwbackupy
gwbackupy: Google Workspace™ backup and restore solution.What is it?Gwbackupy is an open sourceGoogle Workspace™backup and restore solution, written in
python.Currently supported Gmail messages and labels only.Why?Due togmvaultlimitations:is still abandoned (??)authentication method is not usable in Google Workspace widedesigned only for gmail messagesonly supports IMAP protocol (slow and less security)DetailsRun from CLI or run directly from python codeAuthenticationOAUTH 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 interfaceAllows to restore specific moments without using an external snapshot system (eg. zips, file system with snapshot).
Not limited to file storage and is not limited to the use of a database server.Currently, file system based storage is only available.Dry mode (not write to local storage and not modify on server)API communication (no need for special IMAP and other settings): secure and fastGmail backupfull backup (download all messages, labels)full backup continuously (periodically rerunning)Scanning the full mailbox, but download only the new messages and mark the deleted messages.Quick backup (sync the last N days)Gmail restorerestore deleted message in specified intervalfull restore messages and labels to an empty mailbox (e.g. to other gmail account)Paid plans are the following:here. Google One or additional
storages are not considered as paid plansRequirementspython3andpipGoogle Cloudaccount and own created access files.This software does not contain access files, this is for security reasons.A credit card is required during registration, but the use of Workspace APIs is free.InstallThe easiest way for installing:pipinstallgwbackupy# and run...gwbackupy...or# clone this repository# install requirementspipinstall-rrequirements.txt# and run...python3-mgwbackupy...The project also has an officialDockerimage:gwbackupy-docker-under development.
The docker image has scheduled backup runs and also supports managing multiple email accounts.InstructionsGCP OAUTH access setupFor free Gmail plan or paid Google Workspace™ plansGCP Service Account SetupOnly for paid Google Workspace™ plansUsageParametersExample usage GmailBackup run in CLI:gwbackupy\--service-account-key-filepath<service-acount-json-key-file>\--batch-size5\gmailbackup\--email<mailboxemailaddress>Restore run in CLI:gwbackupy\--service-account-key-filepath<service-acount-json-key-file>\--batch-size5\gmailrestore\--add-label"backup-restore-1231"\--add-label"more-restore-label"\--filter-date-from<dateordatetimeeg."2023-01-01">\--filter-date-to<dateordatetimeeg."2023-02-02 03:00:00">\--restore-deleted\--email<sourcebackupmailboxemailaddress>\--to-email<destinationmailboxemailaddress># If you want to a different destination accountBackup run from python code:# WARNING: Calling directly from python code actively change in the current state of development.fromgwbackupy.gmailimportGmailfromgwbackupy.storage.file_storageimportFileStoragefromgwbackupy.providers.gmail_service_providerimportGmailServiceProviderfromgwbackupy.providers.gapi_gmail_service_wrapperimportGapiGmailServiceWrapperstorage=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)ifgmail.backup():print('Yeah!')else:print(':(')SecuritySeeSECURITY.mdContributingWelcome! 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.ChangelogThe changes are contained inCHANGELOG.md.AboutMárton Somogyi