Package: rest-toolkit
rest_toolkitis a Python package which provides a very convenient way to
build REST servers. It is build on top ofPyramid, but you do not
need to know much about Pyramid to use rest_toolkit.Quick exampleThis is a minimal example which defines aRootresource with aGETview, and starts a simple HTTP server. If you run this example you can requesthttp://localhost:8080/and you will see a JSON response with a status
message.from rest_toolkit import quick_serve
from rest_toolkit import resource


@resource('/')
class Root(object):
    def __init__(self, request):
        pass


@Root.GET()
def show_root(root, request):
    return {'status': 'OK'}


if __name__ == '__main__':
    quick_serve()Changelog0.17 - January 10, 2019Fix usage of NotImplemented0.16 - April 14, 2018Fix error in handling of JSON validation errors in arrays.0.15 - April 5, 2018Do not set content-type header on 204 responses.0.14 - May 25, 2017Fix a Pyramid depcreation warning forunauthenticated_userid.0.13 - August 18, 2016Preserve response exceptions raised by resource constructors or views if they
already have a JSON content type.Modify default JSON validation error response format: use the field with the
validation error as key in the response data.Use a customrest_toolkit.ext.jsonschema.JSONValidationErrorexception for
JSON validation errors. This allows for easy customisation of validation error
response by defining a view forJSONValidationError.0.12 - June 1, 2016Pass extra resource and controller arguments to the underlyingadd_view()calls. This allows using predicates for views.0.11 - May 6, 2016Allowupdate_from_dictto return a custom response, which will be used
by the default PATCH and PUT views.0.10 - May 4, 2016Do not require any permssions for OPTIONS requests. This can badly break
authentication, since OPTIONS will be called to check if auth-related
headers may be send.Do not register catch-all exception view if debugging is enabled.0.9 - September 20, 2015Default to not allowing primary key changes for SQLResource objects. This can
be toggled with a newallow_primary_key_changevariable on the resource
class.Correctly setAccess-Control-Allow-Methodsheader for resources using
default views.0.8 - September 5, 2015Correctly handle OPTIONS requests for controllers.Do not require any permissions for the generic error view. This fixes any
errors being converted to forbidden errors on sites with a default
permission.0.7 - March 12, 2015Fix editing of SQL resource.Update default views and validation extensions not to assume anything about
theto_dict()return format.If therest_toolkit.debugis set, or theREST_TOOLKIT_DEBUGenvironment variable is set totrue, or the pyramid’s debug-all flag is
set the system error exception handler will add the exception traceback to
the response under a newtracebackkey.Add basic support for collection resources. These can handlePOSTrequests to create child objects.0.6 - November 4, 2014Make sure controllers for resource whose path do not end in a slash are
reachable.  This fixesissue 12.Fix mismatch between code and documentation: userequest_methodas parameter name for thecontrollerdecorator.0.5 - October 24, 2014Allow overriding the request method for controllers. This fixesissue 10.Addread_permission,update_permissionanddelete_permissionoptions to theresourcedecorator to set permissions for default views.
This fixesissue 8.Rely on fixtures provided by pyramid_sqlalchemy for our SQL-related tests.Preserve headers when converting a HTTP response to JSON. This fixesissue 6.The route name for a resource can now be configured with aroute_nameparameter
for theresourcedecorator.0.4.1 - July 18, 2014Make sure all raised HTTP exceptions are converted to JSON responses.0.4 - July 18, 2014This releases focuses on improving the documentation and fixing problems in the
SQL extension.Fix several errors in the SQLResource defaults views.Configuring the SQL extension is no longer necessary if you usepyramid_sqlalchemyto handle
SQLAlchemy integration.Travisis now setup to
automatically run tests on CPython 2.7, CPython 3.3, CPython 3.4 and PyPy.Fix Python 3 compatibility problem in the generic error view.Drop explicit Python 2.6 support. The tests use too many set literals to make
Python 2.6 worthwile.Modify EditableResource to not inherit from ViewableResource. This makes
the separation between editing and viewing explicit, and works around the
inability of Python to handle the inheritance schemes where a base classes
is used multiple times.Remove the default value forreplaceinEditableResource.updat_from_dict(). This did not serve a useful purpose,
and could be confusing.Setself.requestin SQLResource constructor.0.3 - July 11, 2014This release fixes several critical errors in the SQL extension:Fix the invoction of the context query.Return not-found error from SQLResource instead of an internal error when no
SQL row could be found.Do not enable default views for SQLResource automatically. This should be
an explicit decision by the user.0.2.2 - July 11, 2014Fix several errors in SQL extension.0.2.1 - July 10, 2014Add a MANIFEST.in to the source distribution installable.0.2 - July 9, 2014Several demos showing how to use rest_toolkit with AngularJS have been added.Support for default DELETE, GET, PATCH and PUT views has been added.Various documentation fixes and improvements.0.1 - Released 24 June, 2014This is the first release.