From 2c32e74fd3fcd75086ce7c75c6b57efafcb7a457 Mon Sep 17 00:00:00 2001 From: shim_ <> Date: Wed, 3 Oct 2018 15:34:41 +0200 Subject: [PATCH] fix seafapi.ping --- imports/seafapi.py | 2 +- main.py | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/imports/seafapi.py b/imports/seafapi.py index caa711d..28c6fe9 100644 --- a/imports/seafapi.py +++ b/imports/seafapi.py @@ -16,7 +16,7 @@ class SeafileClient: def ping(self): try: - return self.session.get("%s/ping" % self.api_endpoint()).text == "pong" + return self.session.get("%s/ping" % self.api_endpoint()).text == "\"pong\"" except: return False diff --git a/main.py b/main.py index acea2bd..a5bc75f 100644 --- a/main.py +++ b/main.py @@ -25,6 +25,7 @@ class SeafileUploader(): def showSettingsUI(self, parentWidget): self.parentWidget = parentWidget + #self.processor.configure(parentWidget) self.settingsDialog = self.uil.load(QFile(workingDir + "/settings.ui"), parentWidget) self.settingsDialog.group_account.widget_loggedIn.loginButton.connect("clicked()", self.startAuthenticationProcess) #self.settingsDialog.group_name.input_name.connect("textChanged(QString)", self.nameFormatEdited) @@ -86,11 +87,12 @@ class SeafileUploader(): settings.endGroup() if self.seaf_url and self.access_token: self.seaf_client = SeafileClient(self.seaf_url,self.access_token.username,token=self.access_token) - for lib in self.seaf_client.libraries(): - if lib.id == self.lib_id: - self.seaf_lib = lib - if self.seaf_lib and self.seaf_path: - self.processor = EncryptedProcessor(self.seaf_lib,self.lib_path)#DefaultProcessor(self.seaf_lib,self.lib_path) + if self.seaf_client.ping(): + for lib in self.seaf_client.libraries(): + if lib.id == self.lib_id: + self.seaf_lib = lib + if self.seaf_lib and self.seaf_path: + self.processor = EncryptedProcessor(self.seaf_lib,self.lib_path)#DefaultProcessor(self.seaf_lib,self.lib_path) def saveSettings(self):