archive
/
lantern
Archived
1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
lantern/lantern/route.py

15 lines
466 B
Python
Raw Normal View History

2017-04-11 13:34:09 +01:00
from sanic.response import html
2017-04-11 13:46:53 +01:00
from lantern.handle import execute_handle
from lantern.error import error_response
2017-04-11 14:19:36 +01:00
from lantern.request import serialize_request
2017-04-11 13:34:09 +01:00
import os
2017-04-11 09:18:20 +01:00
async def main_route(request, path=None):
2017-04-11 13:34:09 +01:00
handle = os.path.join(os.path.dirname(__file__), 'test_handle.py')
2017-04-11 14:19:36 +01:00
result = execute_handle(handle, serialize_request(request))
2017-04-11 13:46:53 +01:00
if result.exit_code != 0:
return error_response(result.error)
return html(result.html, status=200)