跳至內容
選單
此問題已被標幟
1 回覆
4228 瀏覽次數

i'm encountering an error like this  while fetching data

  WARNING mydb odoo.http: returns an invalid response type for an http request


Here is my python code

@http.route('/vehicle_web_form', methods=['GET'],  website=True, auth='public', csrf=False)
def vehicle_web_form(self, **kw):
print(kw)
id = kw.get("id")
print(id)
print(type(id))
return id


頭像
捨棄
最佳答案

If you want to return the information you have to use the type JSON instead of HTTP, and return JSON.

For Eg:-

@http.route('/vehicle_web_form', type='json', auth="public", csrf=False)
def vehicle_web_form(self, **kw):
print(kw)
id = kw.get("id")
print(id)
print(type(id))
result_response = json.dumps({'data':id})
return json.loads(result_response)


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
8月 24
2218
2
4月 24
1524
1
12月 23
2534
1
4月 24
2060
2
8月 23
2236