flaskusdz

Fetch USDZ / USD file from flask python not working on safari


I have a server running a basic Flask server with send_file to allow a USDZ file to be downloaded when fetching the endpoint:

@app.route("/make_usd", methods=['GET'])
def make_usd():
    data = usd.create_usd(1, 2, 0.05)
    response = make_response(send_file(data["url"], mimetype="model/vnd.usdz+zip", attachment_filename=data["url"], as_attachment=True))
    response.headers['Access-Control-Allow-Origin'] = "*"
    return response

This works perfectly on Chrome, when fetching http://0.0.0.0:9090/make_usd the file is downloaded ok.

On safari I get "safari unable to open page"

Thanks for helping


Solution

  • when fetching http://0.0.0.0:9090/make_usd

    Why you use 0.0.0.0? If you want to access service locally hosted on the machine you work on? Then use either localhost or 127.0.0.1 instead.