Posts

Showing posts with the label sanic

How to respond to a boolean type in sanic?

Image
Clash Royale CLAN TAG #URR8PPP How to respond to a boolean type in sanic? I need to respond directly to True or False. How can I do this? Json, text, raw.... can't code if param == signature: return True else: return False Error File "/usr/local/lib/python3.5/dist-packages/sanic/server.py", line 337, in write_response response.output( AttributeError: 'bool' object has no attribute 'output' 1 Answer 1 I think what you are looking for is something like this: from sanic import responses @app.get('/myroute') async def myroute(request): output = True if param == signature else False return response.json(output) You just need to wrap your response in response.json . response.json By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cooki...