def get_gdrive_repos(self): gdriverepo_paths = GDriveSync.scan_repo_paths([os.path.expanduser(SyncHandler.LOC)]) gdriverepos = {} for repopath in gdriverepo_paths: gs = GDriveSync(repopath) gdriverepos[gs.repo_hash()] = gs return gdriverepos
def get_gdrive_repos(self): gdriverepo_paths = GDriveSync.scan_repo_paths( [os.path.expanduser(SyncHandler.LOC)]) gdriverepos = {} for repopath in gdriverepo_paths: gs = GDriveSync(repopath) gdriverepos[gs.repo_hash()] = gs return gdriverepos
def action_addgdrive(self): self.set_gdrive_auth_tok() retcode = 0 gfolder = self.get_argument('repo', '').strip() loc = SyncHandler.sanitize_loc(self.get_argument('loc', '').strip()) loc = os.path.join(os.path.expanduser(SyncHandler.LOC), loc) GDriveSync.clone(gfolder, loc, True) return retcode
def action_addgdrive(self): self.set_gdrive_auth_tok() retcode = 0 gfolder = self.get_argument('repo', '').strip() loc = SyncHandler.sanitize_loc(self.get_argument('loc', '').strip()) loc = os.path.join(os.path.expanduser(SyncHandler.LOC), loc) # clone gdrive to local GDriveSync.clone(gfolder, loc, False) # sync existing local files to gdrive gs = GDriveSync(loc) gs.sync() return retcode
def set_gtok(self): tokfile = self.settings['token_file'] self.logger.debug('Checking for auth token at ' + tokfile) if not os.path.exists(tokfile): self.logger.debug('Auth token does not exist at ' + tokfile) raise Exception('No authentication token found') self.logger.debug('Reading auth token from ' + tokfile) with open(tokfile, 'r') as gtok_file: credsb64 = gtok_file.read() self.logger.debug('Initializing drive creds') GDriveSync.init_creds(credsb64)
def set_gdrive_auth_tok(self): gauth = self.get_argument('gauth', '') if len(gauth) > 0: GDriveSync.init_creds(gauth)