My answer focus on node-red.. if you want a hint for python then I suggest you look at the Flask guide. ( https://www.raspberrypi.org/learning/py ... worksheet/
I did a fair amount of googling but couldnt really find a simple example for using the "http" input node to run a script/command.
The node-red documentaton doesn't contain much information about the different nodes either but there is a lot of information in the flow-editor itself.
This was the best I found, you should watch a video about node-red first just to understand the concept.
https://cookbook.nodered.org/http/creat ... point.html
So in my head the only thing you need to add to the simplest http example is an "exec" node that is also connected to the input node and the exec node runs whatever command you need to "turn the lights off".