def __init__(self, cfg=None): """initialize""" self.cfg = cfg global USERNAME, PASSWORD, SSLFINGERPRINT, USE_KEYRING USERNAME = cfg['user'] PASSWORD = cfg['pass'] SSLFINGERPRINT = cfg['sslfingerprint'] USE_KEYRING = cfg['use_keyring'] libVersion = csynclib.csync_version(0, 40, 1) if DEBUG: print 'libocsync version: ', libVersion if libVersion not in ('0.70.4', '0.70.5'): print 'This version of libocsync %s is not tested against ownCloud server 4.7.5.' % libVersion c = csynclib.CSYNC() self.ctx = ctypes.pointer(c) self.buildURL() #pprint.pprint(self.cfg) print 'Syncing %s to %s logging in as user: %s' % ( self.cfg['src'], self.cfg['url'], USERNAME, ) if cfg.has_key('dry_run') and cfg['dry_run']: return self.sync()
def __init__(self, cfg = None): """initialize""" self.auth_callback = None self.log_callback = None self.progress_callback = None self.logger = logging.getLogger("pyOC") self.cfg = cfg self.debug = cfg['debug'] self._user = cfg['user'] self._password = cfg['pass'] self._fingerprint = cfg['sslfingerprint'].lower() self._keyring = cfg['use_keyring'] self.libVersion = csynclib.csync_version(0,40,1) self.logger.debug('libocsync version: %s', self.libVersion) c = csynclib.CSYNC() self.ctx = ctypes.pointer(c) self.buildURL() self.logger.info('Syncing %s to %s, logging in as user: %s' , self.cfg['src'], self.cfg['url'], self._user, ) if cfg.has_key('dry_run') and cfg['dry_run']: return self.sync()