How to use the tomodachi.HttpResponse function in tomodachi

To help you get started, we’ve selected a few tomodachi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kalaspuff / tomodachi / tests / services / http_access_log_service.py View on Github external
async def test_ignore_one(self, request: web.Request) -> tomodachi.HttpResponse:
        test = await request.text()
        if test == '200':
            return tomodachi.HttpResponse(body='test-200', status=200)
        else:
            return tomodachi.HttpResponse(body='test-201', status=201)
github kalaspuff / tomodachi / tests / services / http_access_log_service.py View on Github external
    async def test_ignore_one(self, request: web.Request) -> tomodachi.HttpResponse:
        test = await request.text()
        if test == '200':
            return tomodachi.HttpResponse(body='test-200', status=200)
        else:
            return tomodachi.HttpResponse(body='test-201', status=201)
github kalaspuff / tomodachi / examples / basic_examples / http_simple_service.py View on Github external
async def response_object(self, request: web.Request) -> HttpResponse:
        return HttpResponse(body='{"data": true}', status=200, content_type='application/json')
github kalaspuff / tomodachi / examples / http_service.py View on Github external
async def response_object(self, request: web.Request) -> HttpResponse:
        return HttpResponse(body='{"data": true}', status=200, content_type='application/json')
github kalaspuff / tomodachi / examples / basic_examples / http_auth_service.py View on Github external
async def require_auth_token(instance: Any, request: web.Request) -> Any:
    post_body = await request.read() if request.body_exists else None
    if not post_body or post_body.decode() != instance.allowed_token:
        return HttpResponse(body='Invalid token', status=403)