OPNsense Forum

English Forums => Development and Code Review => Topic started by: moonmoonbird on October 30, 2020, 05:29:49 am

Title: how many ways to pass parameter to python script
Post by: moonmoonbird on October 30, 2020, 05:29:49 am
I implemented a shell command plugin named myshell, The whole procedure of a request from a button click to the python script:

1, fill the command into textfield in the form, and click send button, 'set' api called;
2,updated and reloaded the config file with form data;
3, then called 'execute' api, which routed to Service Action, in here , Backend()->configdRun('myshell execute'), which called python script;
4,in the python script, we can retreive the form data through the config file which template and jinja2 generated, and do something and return.

What i want to ask is that except for this way of parameter delivery, can i pass it through configdRun() or api restful like?