Re: Adding additionnal common request handlers to http.server

My idea behind the APIRequestHandler (by the way, RESTRequestHandler might actually be better) was to provide devs with a simple interface that doesn't require any setup in order to spin up RESTful APIs for personal projects. You're ultimately right, though, in that to scale up, a more robust framework is needed (as I previously mentionned, flask, Django and starlette are much more powerful than a simple class), but they come with their own drawbacks : they are not in the standard library, and they are very heavy. For a dev that just wants to spin up a very basic API, in order to expose their IoT devices to their network for instance, even flask is overkill. And because of the size of these modules, they are unsuitable for embedded development (on a raspberry pi compute module/zero, or with microPython). In my opinion, REST is the best protocol to make two pieces of software communicate with each other, because of its simplicity, yet, the standard library lacks in that regard in my opinion.

On Tue, Aug 25, 2020 at 2:36 AM Simon <simon.bordeyne@gmail.com> wrote:
Fair enough. I guess the real question is, how much advantage is RESTRequestHandler over directly subclassing BaseHTTPRequestHandler? Maybe it'd be worth it just to simplify that case. ChrisA

On Mon, Aug 24, 2020, at 12:39, Chris Angelico wrote:
What about making a stdlib class for building RESTful WSGI applications, which could be used with wsgiref for the lightweight-no-external-dependencies use case? basically a "flask light".

On Tue, Aug 25, 2020 at 2:36 AM Simon <simon.bordeyne@gmail.com> wrote:
Fair enough. I guess the real question is, how much advantage is RESTRequestHandler over directly subclassing BaseHTTPRequestHandler? Maybe it'd be worth it just to simplify that case. ChrisA

On Mon, Aug 24, 2020, at 12:39, Chris Angelico wrote:
What about making a stdlib class for building RESTful WSGI applications, which could be used with wsgiref for the lightweight-no-external-dependencies use case? basically a "flask light".
participants (3)
-
Chris Angelico
-
Random832
-
Simon