Several decorators for using with supercell.api.RequestHandler implementations.
Class decorator for mapping HTTP POST and PUT bodies to
Example:
@s.consumes(s.MediaType.ApplicationJson, model=Model)
class MyHandler(s.RequestHandler):
def post(self, *args, **kwargs):
# ...
raise s.OkCreated()
Parameters: |
|
---|
Class decorator for mapping HTTP GET responses to content types and their representation.
In order to allow the application/json content type, create the handler class like this:
@s.provides(s.MediaType.ApplicationJson)
class MyHandler(s.RequestHandler):
pass
It is also possible to support more than one content type. The content type selection is then based on the client Accept header. If this is not present, ordering of the provides() decorators matter, i.e. the first content type is used:
@s.provides(s.MediaType.ApplicationJson)
class MyHandler(s.RequestHandler):
...
Parameters: |
|
---|