Skip to content

Commit 973efcd

Browse files
committed
adding https support
1 parent 320900f commit 973efcd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rpi-powermeter/powermeter.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import RPi.GPIO as GPIO
44
import json
5+
import ssl
56
import sys
67
import time
78
import logging
@@ -74,7 +75,8 @@ def write_to_elastic(device_id, now_timestamp, interval, voltage, consumed, pric
7475
"current": current
7576
}
7677
}
77-
connection = http.client.HTTPConnection(elastic)
78+
#connection = http.client.HTTPConnection(elastic)
79+
connection = http.client.HTTPSConnection(elastic, context = ssl._create_unverified_context())
7880
connection.request("POST", index + "/_doc", headers = elastic_headers, body = json.dumps(body))
7981
response = connection.getresponse()
8082
logging.info("elastic response: %s", response.status)

0 commit comments

Comments
 (0)