I am trying to call a service from a python script but when I try to run it a get {“message”: “Data should be valid JSON.”} here is my code
url = "http://homeassistant.local:8123/api/services/light/turn_on"
headers = {
"Authorization": "Bearer auth_token",
"content-type": "application/json",
}
data = {
"entity_id": "light.shelf_light_strip",
}
response = requests.post(url, headers=headers, data=body)
print(response.text)