From 27163fb34d57a4ca4e62d304abaabc995137b3a4 Mon Sep 17 00:00:00 2001 From: Scrat Date: Fri, 27 May 2022 21:30:52 +0200 Subject: [PATCH] Add Domoticz traces in Debug mode --- CHANGELOG | 4 +++- gazpar.py | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 909d9ab..8e8a1d5 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -27,4 +27,6 @@ v1.3.5 - Scrat v1.3.6 - Scrat - Fix : Manage the case when no values are present for some days v1.3.7 - Scrat - - Fix : Re-use volume value taken from GRDF websitedue to issue when calcuted volume <1m3 \ No newline at end of file + - Fix : Re-use volume value taken from GRDF websitedue to issue when calcuted volume <1m3 +v1.3.8 - Scrat + - Add Domoticz RQ and RS in debug traces \ No newline at end of file diff --git a/gazpar.py b/gazpar.py index 24314f1..0effecc 100755 --- a/gazpar.py +++ b/gazpar.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- -# (C) v1.3.7 2022-01-21 Scrat +# (C) v1.3.8 2022-01-21 Scrat """Generates energy consumption JSON files from GRDf consumption data collected via their website (API). """ @@ -62,8 +62,10 @@ def domoticzrequest (url): base64string = base64.encodebytes(('%s:%s' % (domoticzusername, domoticzpassword)).encode()).decode().replace('\n', '') request.add_header("Authorization", "Basic %s" % base64string) - try: + try: + logging.debug("Domoticz Request : \n" + request.full_url) response = urllib.request.urlopen(request, context=context) + logging.debug("Domoticz Response : \n" + response.read().decode('utf-8')) return response.read() except urllib.error.HTTPError as e: print(e.__dict__)