duplicity-talk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Duplicity-talk] Gmail backend


From: Mathias Wagner
Subject: [Duplicity-talk] Gmail backend
Date: Fri, 5 May 2006 08:20:23 +0200
User-agent: KMail/1.9.1

Hi,

since Gmail offers currently 2.7 GB free storage and duplicity encrypts the 
backups I tried to write a backend to write backups to a Gmail account.

I did some basic testing and it seems to work.

I used the syntax

gmail://<account-name>/<gmail-label>

For the password I used FTP_PASSWORD (taken from the ftp backend).

I attached the code (it still requires some testing) in the file 
gmailbackend.py.

I also modified backends.py to include the gmail protocol

# Dictionary relating protocol strings to backend_object classes.
protocol_class_dict = {"scp": scpBackend,
                                           "ssh": scpBackend,
                                           "file": LocalBackend,
                                           "ftp": ftpBackend,
                                           "rsync": rsyncBackend,
                                           "gmail": gmailBackend
                                           }


and added 

import sys,shutil

at the beginning of backends.py.

The code requires libgmail (I only tested 0.1.4) from

http://libgmail.sourceforge.net/

In the file libgmail.py I modified in line 1223 (class 
_LabelHandlerMixin(object):) the function addLabel (the line with hasattr)


    def addLabel(self, labelName):
        """
        """
        # Note: It appears this also automatically creates new labels.
        result = self._account._doThreadAction(U_ADDCATEGORY_ACTION+labelName,
                                               self)
        if not hasattr(self,"_labels"):
            self._makeLabelList([])
        # TODO: Caching this seems a little dangerous; suppress duplicates 
maybe?
        self._labels.append(labelName)
        return result


The original code caused errors on my system even with the examples from the 
libgmail documentation (gcp.py)


Maybe someone can test the code and after this it can be integrated in 
duplicity.

I also want to suggest to use bzip2 compression but I will suggest this in a 
different posting.



Mathias




Attachment: gmailbackend.py
Description: application/python


reply via email to

[Prev in Thread] Current Thread [Next in Thread]