While I'm familiar with both HTTP servers and event loops, I'm having some trouble grasping the inner workings of Python's asyncio.
As a learning exercise, I've been trying to write a minimal HTTP server (just echoing out the request method, URI, headers and body), without additional dependencies. I've looked into aiohttp and aiowsgi for reference, but having trouble understanding what's going on there - in part because the perceived complexity of protocols, transports etc. is a bit overwhelming. So I'm currently stuck because I don't quite know where to begin.
Is it naive to expect this to be just a few lines of code to establish the connection, consume the incoming text stream and send back another text stream?
You can take a look on picoweb as example of very simple (and very limited) HTTP server.
But, sure, when you'll try to implement full-feature web server you will get something like aiohttp -- HTTP is complex (even maybe complicated) standard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With