Articles on: Kiosk Browser Remote Management - REST API

Example: Python Device API

Sample code to consume the Device API using Python.

utcnow = datetime.utcnow()

timestamp = utcnow.strftime("%Y-%m-%d %H:%M:%S")
request_type = 'GET'
uri = '/api/device'
payload = request_type + timestamp + uri
key = bytes(os.environ['AKB_SECRET'],"ascii")
raw = bytes(payload,"ascii")
hashed = hmac.new(key, raw, hashlib.sha256)
h = base64.b64encode(hashed.digest()).decode()
authentication = os.environ['AKB_KEY'] + ':' + h
headers = {
"Authentication":authentication,
"Timestamp": timestamp
}
url = 'https://www.kbremote.net' + uri
r = requests.get(url, headers=headers)
print(r.text)

Updated on: 13/09/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!