2014-06-05, 23:57
Hello
I am trying to sent a popup notification to XBMC using curl in a Python script.
This is my notification code that works OK in a web browser.
Once I have ran it in the browser it changes to this:
This is my python script
I get this error when running the python in terminal
curl: (3) [globbing] nested brace in column 122
It doesn't seem to like the nested brackets { }
Ideally I would like the final python script to send two different http commands via curl if possible? One to send a http request to my home automation controller to turn on my lights and the second http request to send a popup notification in XBMC.
This is the working python script that sends a http request to the home automation controller to turn on the lights:
Can any developers / programmers please help me?
Many thanks
I am trying to sent a popup notification to XBMC using curl in a Python script.
This is my notification code that works OK in a web browser.
Code:
http://192.168.1.100:8080/jsonrpc?request={"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Home","message":"Turning Lounge Lights On"},"id":1}
Once I have ran it in the browser it changes to this:
Code:
http://192.168.1.100:8080/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22Home%22,%22message%22:%22Turning%20Lounge%20Lights%20On%22},%22id%22:1}
This is my python script
Code:
#!/usr/bin/env python
import subprocess
proc = subprocess.Popen(["curl", "http://192.168.1.100:8080/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22GUI.ShowNotification%22,%22params%22:{%22title%22:%22Home%22,%22message%22:%22Turning%20Lounge%20Lights%20On%22},%22id%22:1}"])
I get this error when running the python in terminal
curl: (3) [globbing] nested brace in column 122
It doesn't seem to like the nested brackets { }
Ideally I would like the final python script to send two different http commands via curl if possible? One to send a http request to my home automation controller to turn on my lights and the second http request to send a popup notification in XBMC.
This is the working python script that sends a http request to the home automation controller to turn on the lights:
Code:
#!/usr/bin/env python
import subprocess
proc = subprocess.Popen(["curl", "http://192.168.1.101:3480/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=1"])
Can any developers / programmers please help me?
Many thanks