Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
4245 Zobrazení

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


Avatar
Zrušit
Nejlepší odpověď

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)


Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
srp 24
2226
2
dub 24
1536
1
pro 23
2556
1
dub 24
2068
2
srp 23
2255