Answer the question
In order to leave comments, you need to log in
How to do hashing in django?
The mango-office documentation has a line to calculate the variable
Значение sign рассчитывается следующим образом:
sign = sha256(vpbx_api_key + json + vpbx_api_salt)
vpbx_api_key = 'xxxxxxxxxx'
vpbx_api_salt = 'nnnnnnnnnnn'
json = {
"command_id" : "cbk1",
"from" : {
"extension" : "1234",
"number" : "78005553535",
},
"to_number" : "78005553535",
"line_number" : "78005553535",
}
sign = hmac.new(bytearray(vpbx_api_key,'utf-8'), bytearray(vpbx_api_salt,'utf-8'), hashlib.sha256).hexdigest()
vpbx_api_key = 'xxxxxxxxxx'
vpbx_api_salt = 'nnnnnnnnnnn'
data = {
"command_id" : "cbk1",
"from" : {
"extension" : "1234",
"number" : "78005553535",
},
"to_number" : "78005553535",
"line_number" : "78005553535",
}
json_data = json.dumps(data)
sha256sign.update((vpbx_api_key + json_data + vpbx_api_salt).encode('utf-8'))
sign = sha256sign.hexdigest()
{"name":"Unauthorized","message":"You are requesting with an invalid credential.","code":0,"status":401}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question