Note
Most of the classes defined in this module are not fully documented yet. For basic information how to use them (or at least most of them) – please consult the Tutorial.
Bases: object
A Pyramid-URL-dispatch-related class.
Typically, when using n6sdk, you do not need to bother about it.
Bases: pyramid.response.Response
A response class used to serve streamed HTTP responses to client queries.
Bases: object
Can be set to False in a subclass to skip result records that could not be cleaned (by default pyramid.httpexceptions.HTTPServerError is raised).
Create a concrete view subclass (for a particular REST API resource).
This method is called automatically (by HttpResource.configure_views()).
Bases: object
A class of containers of REST API resource properties.
Automatically called by ConfigHelper.make_wsgi_app() or ConfigHelper.complete().
Bases: object
Class of an object that automatizes necessary WSGI app setup steps.
Typical usage in your Pyramid application’s __init__.py:
RESOURCES = <list of HttpResource instances>
def main(global_config, **settings):
helper = ConfigHelper(
settings,
data_backend_api_class=MyDataBackendAPI,
authentication_policy=MyCustomAuthenticationPolicy(settings),
resources=RESOURCES,
)
... # <- here you can call any methods of the helper.config object
... # which is a pyramid.config.Configurator instance
return helper.make_wsgi_app()
(overridable attribute)
(overridable attribute)
alias of DefaultRootFactory
Register a stream renderer factory under the specified name.
Basic usage:
register_stream_renderer(<renderer name>, <renderer factory>)
or:
@register_stream_renderer(<renderer name>)
def make_my_renderer(data_generator, request):
...
or:
@register_stream_renderer(<renderer name>)
class MyRenderer(...):
def __init__(self, data_generator, request):
...
...
Bases: object
The base class for authentication policy classes.
Determines the value that will be set as the auth_data of the request object.
This function is used as a request method that provides the auth_data request attribute (see: ConfigHelper.prepare_config() above), which means that this function is called after unauthenticated_userid() and before meth:authenticated_userid.
It should be implemented as a static method.
Concrete implementation of this method will probably make use of the unauthenticated_userid attribute of request (in older versions of Pyramid the unauthenticated_userid() function from the pyramid.security module was used instead of that attribute).
Concrete implementation of this method will probably make use of the auth_data attribute of request. (The value of that attribute is produced by the get_auth_data() method.)
Bases: n6sdk.pyramid_commons.BaseAuthenticationPolicy
A dummy authentication policy: authenticates everybody (as "anonymous").
It sets, for all requests, the user id and the authentication data to the string "anonymous".