I am trying to get some data in Odoo from outside, work with that data, and give a response.
So I did a controller:
import openerp.http as http
import logging
_logger = logging.getLogger(__name__)
class Controller(http.Controller):
@http.route('/test/result', type='http', auth='none', website=False)
def index(self, **args):
_logger.info('HOLA')
return '{"response": "OK"}'
With this code, if I go to http://localhost:8069/test/result, I get {"response": "OK"}, which is what I want.
The problem is that the request is not going to be typing the controller URL on a browser, but from the code of a website.
So I am trying to connect to the controller from the Python console:
>>> import requests
>>> requests.get('http://localhost:8069/test/result', data='{"x": "test",}')
What I always get is:
>>> <Response [404]>
Instead of '{"response": "OK"}'.
Please, help!