mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-01-20 23:30:17 +01:00
Convert alarmHeaders to OrderedDict
Used OrderedDict for the alarmHeaders to make sure the Dictionary Order is preserved to serve a correctly formated and ordered JSON when using Perl <3.6
This commit is contained in:
parent
14df7d7fa4
commit
9257cb2cfe
|
|
@ -18,6 +18,9 @@ from includes import globalVars # Global variables
|
|||
#from includes.helper import timeHandler
|
||||
from includes.helper import configHandler
|
||||
|
||||
# needed for Ordered Dictionaries to serve correctly ordered JSON
|
||||
from collections import OrderedDict
|
||||
|
||||
##
|
||||
#
|
||||
# onLoad (init) function of plugin
|
||||
|
|
@ -125,13 +128,13 @@ def run(typ,freq,data):
|
|||
alarmData = json.dumps(alarmData)
|
||||
logging.debug(alarmData)
|
||||
|
||||
alarmHeaders = {
|
||||
"Content-Type": "application/json",
|
||||
"webApiToken": webApiToken,
|
||||
"accessToken": accessToken,
|
||||
"selectiveCallCode": selectiveCallCode,
|
||||
"hmac": hmac.new(webApiKey, webApiToken + selectiveCallCode + accessToken + alarmData, digestmod=hashlib.sha256).hexdigest()
|
||||
}
|
||||
alarmHeaders = OrderedDict([
|
||||
("Content-Type", "application/json"),
|
||||
("webApiToken", webApiToken),
|
||||
("accessToken", accessToken),
|
||||
("selectiveCallCode", selectiveCallCode),
|
||||
("hmac", hmac.new(webApiKey, webApiToken + selectiveCallCode + accessToken + alarmData, digestmod=hashlib.sha256).hexdigest())
|
||||
])
|
||||
logging.debug(alarmHeaders)
|
||||
|
||||
if globalVars.config.get("FFAgent", "live") == "1":
|
||||
|
|
|
|||
Loading…
Reference in a new issue