HTTP Post with Tokens

Hi all,

I trying to implement the new token authentication that was introduced a few versions ago with sending HTTP Post.

I would like to use Python in a different program (Event Ghost) to send the HTTP Post.

I am basicly trying to implement the following:

$ curl -X POST -H “Authorization: Bearer ABCDEFGH”
-H “Content-Type: application/json”
-d ‘{“entity_id”: “switch.christmas_lights”}’
http://localhost:8123/api/services/switch/turn_on

from requests import post

url = ‘http://192.168.1.XX:8123/api/services/switch/turn_on

headers = {‘authorization’: ‘Bearer Token’,‘content-type’: ‘application/json’}

body = {‘entity_id’: ‘switch.fibaro’} <---------------------- What to do with this line??

txt04 = post(url, headers=headers)
print(txt04.text)

Thanks,
Alon