dogeweb - WSGI is overrated.

Submodules

app handler onerror timeout

Create a complete application. handler is a function that accepts request.Requests and returns something that can be converted into a response.Response. onerror is a function that accepts a request.Request and a response.Abort, but is otherwise similar to a handler. timeout is how long to wait for requests, in seconds. The timer starts at the beginning of the connection or after sending a response over a keep-alive connection, and ends just before handling the request. Unless a complete request appears within that timeframe, the connection is aborted.

Also available as main.Server.

__call__ loop

Construct a callback for asyncio.StreamReaderProtocol that would read requests, call handlers, and write responses when used.

run ...

Start a development server. The arguments are the same as for util.start_server, except that callback is already provided. This method does not return unless you manually stop the event loop.

If you have libh2o and h2py installed, you can pass another parameter to this method: http2: True. As is obvious from the name, it enables HTTP/2 (and makes HTTP/1.1 twice as fast, because pure C.) Note that some clients may refuse HTTP/2 unless TLS is also enabled, though.

property handler

(This function is only useful in dg.) Import this into a namespace to enable a shorthand notation for handlers. Where you’d normally write

handler = request -> do_something_with request.form

you can instead do

import '/dogeweb/property'

handler = ~> do_something_with @form

This overshadows the property built-in, so use carefully.

abort code info headers

Same as response.abort.

redirect path info code

Same as response.redirect.

static path attachment headers

Same as response.static.

jsonify smth

Same as response.jsonify.