Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@http('GET', r'/response/?')
async def response_object(self, request: web.Request) -> HttpResponse:
return HttpResponse(body='{"data": true}', status=200, content_type='application/json')
@tomodachi.http('GET', r'/health')
async def health_check(self, request):
return 'healthy'
@http('POST', r'/validate/?')
@require_auth_token
async def validate(self, request: web.Request) -> str:
return 'Valid auth token!'
@http('GET', r'/get-token/?')
async def get_token(self, request: web.Request) -> str:
return self.allowed_token
@http('GET', r'/example/(?P[^/]+?)/?')
async def example_with_id(self, request: web.Request, id: str, **kwargs: Any) -> str:
return '友達 (id: {})'.format(id)
@http('GET', r'/example/(?P[^/]+?)/?')
async def example_with_id(self, request: web.Request, id: str) -> str:
return '友達 (id: {})'.format(id)
@tomodachi.http('GET', r'/')
async def index_endpoint(self, request):
return 'friends forever!'
@http('GET', r'/response/?')
async def response_object(self, request: web.Request) -> HttpResponse:
return HttpResponse(body='{"data": true}', status=200, content_type='application/json')
@http('GET', r'/(?:|index.html)')
async def index(self, request: web.Request) -> web.Response:
path = '{}/{}'.format(os.path.dirname(self.context.get('context', {}).get('_service_file_path')), 'public/index.html')
response = FileResponse(path=path, # type: ignore
chunk_size=256 * 1024) # type: web.Response
return response