lundi 4 novembre 2019

How to handle GET requests with Python CGI and send a Response back

I would like to make a GET request to one of my Python CGI files and get a response back, is there a way to handle that with raw CGI? if not, what other tool would you recommend that could potentially solve this issue? (Flask maybe?)

This is needed so I can give the backend a string to sign and return the newly created signed string back to me.

test.html -- This is what's making a GET request to gethandle.py

<script>
    $.getJSON('gethandle.py', some_data, () => {alert('done')})
</script>

gethandle.py -- This is my CGI script that should do things with the request and send a response, this is the part where I am not sure what to do.

#get some_data and do things with it
#send back other_data

as it is now; when inspecting the Network tab on the browser Inspector, I see the request made to gethandle.py from test.html with a 200 status but the response is raw gethandle.py file




Aucun commentaire:

Enregistrer un commentaire