HTTP Post issue using python

Afternoon All,

Wondering if any savy people could help me out here. I used Eventghost to quickly trigger lights and switches from my keyboard. I had the follwong python hacked together from different sources on the internet and some guess work.

 import requests
 url = 'https://XXXXX.com/api/services/light/toggle?api_password=XXXXX'
 headers = {'content-type': 'application/json'}
 data = '{"entity_id": "light.space"}'
 response = requests.post(url, data, headers=headers)
 print(response.text)

I upgraded my EventGhost and the above no longer works. I’ve also posted in their forums but I believe this may be a generic python thing and the cominuty here is larger and a lot of you seem to have a good understanding of python, so I may have a greater chance of success. I hope this is okay as it’s HA related (admin please remove if I’ve over stepped posting here).

I get the below errors, I’m assuming these are generic python errors based on the updated libary used:

I don’t know if it means much but in the update of Eventghost the referenced folder for python chanes from “lib26” to “lib27”. This may be an internal thing for them but thought I’d mention it incase it has any bearing on python generically.

Edit: Solved with an update.

Api_password is being deprecated and will not work on a very near update.