My code looks like this. I just need to be able to access that object. I come from a javascript background and am used to being able to capture the response object and access the response body and all is well. I am not quite understanding how I am to access that though. I have tried form["key_name"].value
etc but still get back nothing. Can someone please help me access my data from FieldStorage(None, None, '{"phrase":"work mudasucka!"}')
? I would greatly appreciate it!
def do_POST(self):
if self.path=="/send":
form = cgi.FieldStorage(
fp=self.rfile,
headers=self.headers,
environ={'REQUEST_METHOD':'POST',
'CONTENT_TYPE':self.headers['Content-Type'],
})
print (form)
self.send_response(200)
self.end_headers()
return
#This is what prints in my console.
#FieldStorage(None, None, '{"phrase":"work mudasucka!"}')