|
|
|
@ -144,7 +144,10 @@ def configureLogger(loggerName):
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
def registerDeviceIP():
|
|
|
|
|
ssl.wrap_socket = sslwrap(ssl.wrap_socket) # using the overridden sslwrap that uses TLSv1
|
|
|
|
|
if sys.version_info<(2,7,9):
|
|
|
|
|
dcConncection = httplib.HTTPSConnection(host=DC_IP, port=DC_PORT)
|
|
|
|
|
else:
|
|
|
|
|
dcConncection = httplib.HTTPSConnection(host=DC_IP, port=DC_PORT, context=ssl._create_unverified_context())
|
|
|
|
|
#TODO need to get server certificate when initializing https connection
|
|
|
|
|
dcConncection.set_debuglevel(1)
|
|
|
|
|
dcConncection.connect()
|
|
|
|
@ -172,7 +175,11 @@ def registerDeviceIP():
|
|
|
|
|
# This method connects to the Device-Cloud and pushes data
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
def connectAndPushData():
|
|
|
|
|
if sys.version_info<(2,7,9):
|
|
|
|
|
dcConnection = httplib.HTTPSConnection(host=DC_IP, port=DC_PORT)
|
|
|
|
|
else:
|
|
|
|
|
dcConnection = httplib.HTTPSConnection(host=DC_IP, port=DC_PORT, context=ssl._create_unverified_context())
|
|
|
|
|
|
|
|
|
|
dcConnection.set_debuglevel(1)
|
|
|
|
|
dcConnection.connect()
|
|
|
|
|
request = dcConnection.putrequest('POST', PUSH_ENDPOINT)
|
|
|
|
|