When I send a post request to this api in postman I get a response output to my post request. I just want to know how I can print this to the screen and/or parse it to use the response for further use
url = ("https://mysupersecretapi/123456/execute")
headers = {'Accept': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'Authorization': 'basic' , 'Content-Type':'application/json;charset=utf-8'}
perameters = {
"inputs": {
"Container_Full": 'true',
"Container_Note": "",
"Output_Stream_Id": "1",
"Piece_Serialized": "<Container><Pieces><PieceSerialNo>"+strContainer[0]+"</PieceSerialNo> <CustomerSerialNo/><Note></Note></Pieces></Container> ",
"Qty_Is_Container_Qty": 'true',
"Quantity": 1,
"Workcenter_Key": 58368,
"Validate_Only": 'false',
"Start_New_Container": 'true'
}
}
plexReq = requests.post(url,auth=HTTPBasicAuth, headers=headers, json=perameters)
print(plexReq.request.headers)
####START HERE
print(plexReq.status_code)
response = requests.get(url)
plexResponse = json.dumps(response.json)
print(plexResponse)
'''
HERE IS THE OUTPUT I GET WHEN USING POSTMAN
{
"outputs": {
"New_Container": null,
"New_Serial_No": null,
"Recorded_Master_Unit_No": null,
"Recorded_Part_No": null,
"Recorded_Quantity": null,
"Recorded_Revision": null,
"Recorded_Serial_No": null,
"Result_Code": 5106,
"Result_Error": true,
"Result_Message": "Workcenter status does not allow production",
"Validation_Failed": false
},
"tables": [],
"transactionNo": "2069710"
}
'''