From 5b3cd028a7be2d76ff28ba00e7e0a639f9f265bf Mon Sep 17 00:00:00 2001 From: FoxMaSk Date: Sat, 23 Sep 2017 21:18:28 +0200 Subject: [PATCH] do no exit if a user changed or does not provide the correct host, client_id, client_key, login, pass --- wallabag_api/__init__.py | 2 +- wallabag_api/wallabag.py | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/wallabag_api/__init__.py b/wallabag_api/__init__.py index 1dcc671..39a72b4 100644 --- a/wallabag_api/__init__.py +++ b/wallabag_api/__init__.py @@ -1,2 +1,2 @@ -VERSION = (1, 2, 0) # PEP 386 +VERSION = (1, 2, 1) # PEP 386 __version__ = ".".join([str(x) for x in VERSION]) diff --git a/wallabag_api/wallabag.py b/wallabag_api/wallabag.py index aa7c746..7a18511 100644 --- a/wallabag_api/wallabag.py +++ b/wallabag_api/wallabag.py @@ -97,18 +97,21 @@ class Wallabag(object): :param responses: the json response :return the json data without 'root' node """ - if responses.status != 200: - raise HttpProcessingError(code=responses.status, - message=await responses.json()) json_data = {} - try: - json_data = responses.json() - except ClientResponseError as e: - # sometimes json_data does not return any json() without - # any error. This is due to the grabbing URL which "rejects" - # the URL - logging.error("Wallabag: aiohttp error {code} {message}" - .format(code=e.code, message=e.message)) + if responses.status != 200: + err_msg = HttpProcessingError(code=responses.status, + message=await responses.json()) + logging.error("Wallabag: aiohttp error {err_msg}".format( + err_msg=err_msg)) + else: + try: + json_data = responses.json() + except ClientResponseError as e: + # sometimes json_data does not return any json() without + # any error. This is due to the grabbing URL which "rejects" + # the URL + logging.error("Wallabag: aiohttp error {code} {message}" + .format(code=e.code, message=e.message)) return await json_data @staticmethod