I am trying to extract audio from MIME with no luck. The endpoint is sending to FLASK API, endpoint it's sending Metadata and Audio, I've captured in Wireshark to understand what's being sent. I can extract the Metadata files, if I try to extract the audio I get an audio file with 0bytes. Code and screenshots attached.
Wireshark Trace: Wireshark Trace
Code:
from flask import Flask, request
from flask_restful import Api, Resource
from werkzeug.utils import secure_filename
import json
app = Flask(__name__)
api = Api(app)
class PostMetaAudio(Resource):
def post(self):
#This bit WORKS
m = request.form.get('metadata')
json_object = json.loads(m)
guid = (json_object["metadata"]["redBoxCallGuid"])
with open(r'C:/Users/folder/Documents/' + str(guid) + ".json", "w" ) as file:
file.write(m)
file.flush()
#This bit does NOT WORK
f = request.form.get("media_audio_wav")
#print(f)
with open(r'C:/Users/folder/Documents/' + str(guid) + ".wav", "wb" ) as file:
file.write(f)
file.flush()
Error Message: Error Message
Files Created: Files Created