From 527747d0ab381f88ad55cdb6ba8270931d3d2318 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 8 Nov 2017 14:39:10 +0100 Subject: [PATCH] Setting loglevel of the requests module --- pp_lib/pdns_app.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pp_lib/pdns_app.py b/pp_lib/pdns_app.py index 0b75cd1..6f3d0b3 100644 --- a/pp_lib/pdns_app.py +++ b/pp_lib/pdns_app.py @@ -24,7 +24,7 @@ from .common import pp, to_bool from .cfg_app import PpCfgAppError, PpConfigApplication -__version__ = '0.2.0' +__version__ = '0.2.1' LOG = logging.getLogger(__name__) _LIBRARY_NAME = "pp-pdns-api-client" @@ -355,6 +355,9 @@ class PpPDNSApplication(PpConfigApplication): if self.verbose > 1: LOG.debug("executing pre_run() ...") + LOG.debug("Setting Loglevel of the requests module to WARNING") + logging.getLogger("requests").setLevel(logging.WARNING) + super(PpPDNSApplication, self).pre_run() # ------------------------------------------------------------------------- @@ -420,9 +423,10 @@ class PpPDNSApplication(PpConfigApplication): try: if not response.ok: + LOG.debug err = response.json() - code = err['httpStatus'] - msg = err['messages'] + code = response.status_code + msg = err['error'] if response.status_code == 401: raise PDNSApiNotAuthorizedError(code, msg, url) if response.status_code == 404: -- 2.39.5