You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
501 B
Plaintext
17 lines
501 B
Plaintext
import ssl
|
|
from aiohttp import web
|
|
|
|
async def handle(request):
|
|
name = request.match_info.get('name', "Anonymous")
|
|
text = "Hello, " + name
|
|
return web.Response(text=text)
|
|
|
|
app = web.Application()
|
|
app.add_routes([web.get('/', handle),
|
|
web.get('/{name}', handle)])
|
|
|
|
if __name__ == '__main__':
|
|
sslc = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
|
sslc.load_cert_chain("certs/certificate.crt", "certs/private.key")
|
|
web.run_app(app, port=5000, ssl_context=sslc)
|