Я создал publi c маршрут в Odoo10 с типом json
, и я попытался вызвать его из API cl inet (AR C), я получаю ошибку 404 Not found. Я не знаю почему.
Вот мой код
controller.py
# -*- coding: utf-8 -*-
from odoo import http,tools
from odoo.http import request, Response
import requests
class TestURL(http.Controller):
@http.route('/create_lead', type="json", method=['POST'], auth='public', csrf=False)
def createLead(self,**kw):
print('Inside create lead')
// rest of the code here
Вот ответ, который я получаю в API клиент:
{"jsonrpc": "2.0", "id": null, "error": {"message": "404: Not Found", "code": 404, "data": {"debug": "Traceback (most recent call last):\n File \"/home/user/Projects/odoo-10/odoo/http.py\", line 642, in _handle_exception\n return super(JsonRequest, self)._handle_exception(exception)\n File \"/home/user/Projects/odoo-10/odoo/http.py\", line 1471, in _dispatch_nodb\n func, arguments = self.nodb_routing_map.bind_to_environ(request.httprequest.environ).match()\n File \"/usr/local/lib/python2.7/dist-packages/werkzeug/routing.py\", line 1581, in match\n raise NotFound()\nNotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.\n", "exception_type": "internal_error", "message": "404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.", "name": "werkzeug.exceptions.NotFound", "arguments": []}, "http_status": 404}}