On Mon, Aug 24, 2020 at 11:26 PM Simon <simon.borde...@gmail.com> wrote: > > The standard library module http.server already has 2 request handlers, with > SimpleHTTPRequestHandler and CGIHTTPRequestHandler, the first serves files > from a directory, and the second executes CGI scripts. > > Two new handlers could be included in the standard library : > > - WebhookRequestHandler : Would spin up an HTTP server that one could connect > webhooks to. Webhooks are really useful when dealing with APIs. So far, the > third-party package, requests, is used when interacting with Web APIs, but > there is nothing in the standard library that implements the webhook standard. > > - APIRequestHandler : This can be more controversial, especially with > third-party packages like Flask, starlette, and django that will be much more > powerful and secure than this, but this handler would be used to spin up a > server that would make it easy to serve a simple restful API. >
Not really in favour of "API" as a name. If you want a simple RESTful API framework, I'd call it something with REST in the name. But I'm not sure that that's needed, since you'd quickly outgrow a simple class and need to go for Flask/Django/etc. Webhooks are very tempting. There's a lot to be said for properly implementing this protocol in the standard library. It might be a bit harder, though, since it basically wants asynchronous or threaded I/O. Maybe this would be a good addition to asyncio? ChrisA _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/OYIOTWMKYXK3YT3Q3GZ7DL57YCUKMZ2F/ Code of Conduct: http://python.org/psf/codeofconduct/