How does it work?

Endpoints translates requests to python modules without any
configuration. It uses the convention:

METHOD /module/class/args?kwargs

To find the modules, you assign a base module (a prefix) that endpoints
will use as a reference point to find the correct submodule using the
path. This makes it easy to bundle your controllers into something like
a controllers module. Some examples of how http requests would be
interpretted:

Requests are translated from the left bit to the right bit of the path
(so for the path /foo/bar/che/baz, Endpoints would check for the
foo module, then the foo.bar module, then the foo.bar.che
module, etc. until it fails to find a valid module). Once the module is
found, endpoints will then attempt to find the class with the remaining
path bits. If no class is found, Default will be used.

There is also a get_param decorator when you just want to make sure
a query param exists and don’t care about post params and a
post_param when you only care about posted parameters. There is also
a require_params decorator that is a quick way to just make sure
certain parameters were passed in:

Sample Mongrel2 script

NOTE – We no longer use Mongrel2, so this interface will most
likely not be developed further and might eventually be removed if we
make any big changes that would involve us having to modify this
interface. You’ve been warned.

Other

todo, move our auth_basic, and auth_oauth decorators into a
decorators sub module? Only problem I see with this is doing the
actual authentication, so there needs to be a way for the module to call
another method and return if it is valid, not sure how we would want to
make that generic or if it is worth trying to make that generic. The
other issue is we use
decorators for all
those decorators and I’m not sure I want to introduce a dependency.

Install

Use PIP

pip install endpoints

If you want the latest and greatest, you can also install from source: