Hey all,
I’m trying to send an image to my tidbt through the the api but am getting the follow response about a signing method.
{'code': 16, 'message': 'invalid auth token: signing method (alg) is unavailable.', 'details': []}
I believe I’m following the instructions in the thread linked below correctly, but am failing to understand what I’m doing wrong. See below for my full code, as well as a link to the repo.
Thanks much in advance for any advice!
def send_to_tidbyt(img, auth_key, device_id, background=False):
"""Updates Tidbyt screen
See https://github.com/dansteingart/tidbytplotlib/blob/main/tidbytplotlib.py#L95-L110
for reference implementation
"""
headers = {"Content-Type": "application/json", "Authorization": f"Bearer {auth_key}"}
buffered = BytesIO()
img.save(buffered, format="JPEG")
img_bytes = base64.b64encode(buffered.getvalue())
url = f"https://api.tidbyt.com/v0/devices/{device_id}/push"
dd = {}
dd["image"] = img_bytes.decode()
dd["background"] = background
payload = json.dumps(dd)
response = requests.request("POST", url, data=payload, headers=headers)
print(response.json())
return response