Reputation: 33293
So here is what I am trying to do.. I want to capture the response from user (which i take the from user from a web gui) and then send those responses to different python function for processing.
So here is what the flow looks like
Program ---> Flask APp --|
/\ |
|_____________________|
My program is like:
def call_flask():
call_hello()
and
def call_hello():
data = request.form
for data_tuple in data:
requests[data_tuple] = data[data_tuple]
return render_template('request_submitted.html')
I am interested in sending "requests" to the main program? What is a clean way to do this..
Upvotes: 0
Views: 393
Reputation: 6317
Don't know if I understand it right... This "Program" is totally different thing and not the web interface you are talking about? If this is totally different thing, then what you can actually do it - after the flask is done with the request, you can have function which does what you want. So if the "Program" sits somewhere in the same machine, you can call process to run or it somehow start that.
Flask does have after_request function, which tells what needs to be done after each request is finished. Here could be a good place to call "Program". But of course then you need to know how you want to call. I can imagine you calling some other url with the json payload, or just calling system app with arguments. But this depends on you :)
But if the "Program" is just a web gui you are talking about, then you just obviously render the template and returning some variables to it, to be rendered.
Hope I got your question right ;)
Upvotes: 1