From: Frank Brehm Date: Wed, 8 Nov 2017 13:39:10 +0000 (+0100) Subject: Setting loglevel of the requests module X-Git-Tag: 0.1.2~105 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=527747d0ab381f88ad55cdb6ba8270931d3d2318;p=pixelpark%2Fadmin-tools.git Setting loglevel of the requests module --- 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: