Skip to content

Commit

Permalink
Add Domoticz traces in Debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrat committed May 27, 2022
1 parent 118b95d commit 27163fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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
- 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
6 changes: 4 additions & 2 deletions gazpar.py
Original file line number Diff line number Diff line change
@@ -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).
"""
Expand Down Expand Up @@ -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__)
Expand Down

0 comments on commit 27163fb

Please sign in to comment.