Bruno
01/28/2026, 3:36 AMkey = '[ENTER API KEY ID HERE]'
secret = '[ENTER API SECRET HERE]'
url = 'https://www.grantinterface.com/API/DataSet/GetData'
unixtime = time.time()
body = '{"timestamp":' + str(unixtime) + '}'
secretBytes = bytearray.fromhex(secret)
bodyBytes = bytearray(body, "utf8")
signature = hmac.new(secretBytes, bodyBytes, digestmod=hashlib.sha256).hexdigest()
headers = {
'Content-type': 'application/json',
'GLM-API-Key': key,
'GLM-API-Signature': signature
}
It seems the secret is encoded in hex, and need to be decoded from HEX to be used (instead of a string) bytearray.fromhex(secret) . Is there a way to specify to sling that the secret encoding is HEX to do the proper conversion?flarco
01/28/2026, 11:43 AMsecret_encoding property.
your auth block will look like this:
yaml
authentication:
type: hmac
algorithm: sha256
secret: "{secrets.api_secret}"
secret_encoding: hex # decode from hex before signing
signing_string: "{http_body_raw}"
request_headers:
Content-type: "application/json"
GLM-API-Key: "{secrets.api_key}"
GLM-API-Signature: "{signature}"flarco
01/28/2026, 11:46 AMBruno
01/28/2026, 4:56 PMflarco
01/28/2026, 11:54 PMBruno
01/29/2026, 12:38 AM