nncli

NextCloud Notes Command Line Interface
git clone git://git.danielmoch.com/nncli.git
Log | Files | Refs | LICENSE

commit 04517eeab3ab8295ce352b6dcb876b11bb4f7a57
parent 85558d58b28e64ad261092eef7160ba0b1d9f761
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Fri, 27 Jul 2018 13:47:29 -0400

Change status to online

NextCloud Notes doesn't have an authenticate API, which is where sncli
set its state to online. We therefore need to set it after any
successful API call.

Diffstat:
Mnnotes_cli/nnotes.py | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/nnotes_cli/nnotes.py b/nnotes_cli/nnotes.py @@ -91,6 +91,7 @@ def get_note(self, noteid): res = requests.get(url) res.raise_for_status() note = res.json() + self.status = 'online' except ConnectionError as e: self.status = 'offline, connection error' return e, -1 @@ -146,6 +147,7 @@ def update_note(self, note): res = requests.post(url, data=data) res.raise_for_status() note = res.json() + self.status = 'online' except ConnectionError as e: self.status = 'offline, connection error' return e, -1 @@ -218,6 +220,7 @@ def get_note_list(self, category=None): res.raise_for_status() #logging.debug('RESPONSE OK: ' + str(res)) note_list = res.json() + self.status = 'online' except ConnectionError as e: self.status = 'offline, connection error' status = -1 @@ -257,6 +260,7 @@ def delete_note(self, note_id): #logging.debug('REQUEST DELETE: ' + self.DATA_URL+params) res = requests.delete(url) res.raise_for_status() + self.status = 'online' except ConnectionError as e: self.status = 'offline, connection error' return e, -1