I am trying to do a put request to address a single panel, this is what I have, but no luck:
url = "http://IP:16021/api/v1/WORKINGTOKENHERE/effects/"
headers = CaseInsensitiveDict()
headers["Content-Type"] = "application/json"
data = """
"command": "display",
"animType": "static",
"animData": "1 5 1 255 0 0 0 1",
"loop": false,
"palette":"[]"
"""
Hey @gtt1229
Try this:
{
"write":{
"command": "display",
"animType": "static",
"animData": "1 5 1 255 0 0 0 1",
"loop": false,
"palette":"[]"
}
}
Regards
@"Aliakbar Eski"
I ended up looking through the Python API https://pypi.org/project/nanoleafapi/
Looks like I had to use json.dumps(data) to sanitize it or something.
New code:
headers = CaseInsensitiveDict()
headers["Content-Type"] = "application/json"
data = {"write": {"command": "display",
"version": "1.0",
"animType": "static",
"animData": "1 5 1 10 255 180 0 1",
"loop": False,
"palette":[]}}
resp = requests.put(url, headers=headers, data=json.dumps(data))