Ok, I see the problem now. I wasn’t importing the global request object. From Quickstart — Flask Documentation (3.0.x)
First of all you have to import it from the
flask
module:
from flask import request
That means the request works if I change my above example to
from dash import Dash
from flask import request # <<< This was missing entirely
app = Dash("demo")
server = app.server
@server.put('/api/contents/<dest_dir>/<dest_file>')
def upload_audio(dest_dir, dest_file):
print(f"upload_audio with {(dest_dir, dest_file)}")
request_json = request.json
...