ccd4c9615c
Update all tests to be compatible with requests-async Cleanup testing client changes with black and isort Remove Python 3.5 and other meta doc cleanup rename pyproject and fix pep517 error Add black config to tox.ini Cleanup tests and remove aiohttp tox.ini change for easier development commands Remove aiohttp from changelog and requirements Cleanup imports and Makefile
27 lines
478 B
Python
27 lines
478 B
Python
# Run with python3 simple_server.py PORT
|
|
|
|
import asyncio
|
|
import sys
|
|
|
|
import ujson as json
|
|
import uvloop
|
|
|
|
from aiohttp import web
|
|
|
|
|
|
loop = uvloop.new_event_loop()
|
|
asyncio.set_event_loop(loop)
|
|
|
|
|
|
async def handle(request):
|
|
return web.Response(
|
|
body=json.dumps({"test": True}).encode("utf-8"),
|
|
content_type="application/json",
|
|
)
|
|
|
|
|
|
app = web.Application(loop=loop)
|
|
app.router.add_route("GET", "/", handle)
|
|
|
|
web.run_app(app, port=sys.argv[1], access_log=None)
|