Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Odoo controller receive blob

Tags:

odoo

I need to send audio file from browser to python controller. Im doing it like this:

var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "POST", "http://localhost:8069/my_controller/", false );
xmlHttp.send(blob);  // blob is Blob object with wav file

And on server side:

from odoo import http

class MyController(http.Controller):
    @http.route('/my_controller/', type='http', auth='public', methods=['POST'], csrf=False, cors="*")
    def my_controller(self, data=None, **kw):
        pass

I cant find a way to receive sent by XMLHttpRequest data. Will appreciate any help. Thanks.

like image 714
StackUser Avatar asked Feb 04 '26 10:02

StackUser


1 Answers

from odoo.http import request
data = request.httprequest.data
like image 150
StackUser Avatar answered Feb 06 '26 23:02

StackUser