[Python-ideas] Re: Adding additionnal common request handlers to http.server

2020-08-25 Thread Alex Hall
On Tue, Aug 25, 2020 at 7:15 PM Christopher Barker wrote: > On Tue, Aug 25, 2020 at 8:11 AM Simon wrote: > >> I find that flask's approach to this is quite pythonic. It's also >> relatively easy to use and explain. >> >> This is a good point, I think you distracted a bit earlier by saying it >

[Python-ideas] Re: Adding additionnal common request handlers to http.server

2020-08-25 Thread Christopher Barker
On Tue, Aug 25, 2020 at 8:11 AM Simon wrote: > I find that flask's approach to this is quite pythonic. It's also > relatively easy to use and explain. > > This is a good point, I think you distracted a bit earlier by saying it would be familiar to flask users. That's true, but not the point.

[Python-ideas] Re: Adding additionnal common request handlers to http.server

2020-08-25 Thread Simon
I find that flask's approach to this is quite pythonic. It's also relatively easy to use and explain. With this approach, as demonstrated by the example I provided, any dev can spin up a server that serves an API in virtually no time, which is why, out of all the possible approaches (Having an

[Python-ideas] Re: Adding additionnal common request handlers to http.server

2020-08-24 Thread Guido van Rossum
I can't help the feeling that this is much more appropriate for PyPI than for the stdlib. There are just too many different ways to do it. (For example, what if the user isn't familiar with flask?) On Mon, Aug 24, 2020 at 1:45 PM Simon wrote: > > Fair enough. I guess the real question is, how

[Python-ideas] Re: Adding additionnal common request handlers to http.server

2020-08-24 Thread Random832
On Mon, Aug 24, 2020, at 12:39, Chris Angelico wrote: > On Tue, Aug 25, 2020 at 2:36 AM Simon wrote: > > 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

[Python-ideas] Re: Adding additionnal common request handlers to http.server

2020-08-24 Thread Simon
> 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 Well, maybe an example would be more telling. Below is a basic usage of the handler I wrote :

[Python-ideas] Re: Adding additionnal common request handlers to http.server

2020-08-24 Thread Chris Angelico
On Tue, Aug 25, 2020 at 2:36 AM Simon wrote: > > 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

[Python-ideas] Re: Adding additionnal common request handlers to http.server

2020-08-24 Thread Simon
> > > 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 : > > > > -

[Python-ideas] Re: Adding additionnal common request handlers to http.server

2020-08-24 Thread Chris Angelico
On Mon, Aug 24, 2020 at 11:26 PM Simon 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