Cowbird: Middleware operation service

Cowbird (the brood parasite)

The brood parasite manipulates a host, either of the same or of another species, *to raise its young as if it were its own
The shiny cowbird is an obligate brood parasite, meaning that adults will lay their eggs in the nests of other species and their offspring rely entirely on their hosts for parental care.

Cowbird is a middleware that manages interactions between various birds of the bird-house stack.

It therefore relies on the existence of other services under a common architecture, but applies changes to the resources under those services such that the complete ecosystem can seamlessly operate together (see Components Diagram).

dependencies

Requires Python 3.7+ Dependencies Status

build status

Readthedocs Build Status (master branch)

tests status

Github Actions CI Build Status (master branch) Github Actions CI Build Status (latest tag) Travis-CI CodeCov Coverage Codacy Badge

docker status

Docker Build Status (latest tag) Docker Build Status (latest tag)

releases

Latest Tag Commits since latest release

Documentation

The REST API documentation is auto-generated and served under {COWBIRD_URL}/api/ using Swagger-UI with tag latest.

More ample details about installation, configuration and usage are provided on readthedocs.
These are generated from corresponding information provided in docs.

Configuration and Usage

Multiple configuration options exist for Cowbird application.
Please refer to configuration for details.
See usage for details.

Change History

Addressed features, changes and bug fixes per version tag are available in CHANGES.

Docker Images

Following most recent variants are available:

Version

Cowbird Base

Cowbird Worker

Cowbird Web Service

Most Recent Release

pavics/cowbird:1.1.1

pavics/cowbird:1.1.1-worker

pavics/cowbird:1.1.1-webservice

Latest Commit

pavics/cowbird:latest

pavics/cowbird:latest-worker

pavics/cowbird:latest-webservice

Notes:

Table of Contents

Usage

In most situation, you will want to run Cowbird as a Web Application in combination with a larger set of bird-house components forming a server instance. A minimal docker-compose.yml example is provided, but Cowbird’s actual configuration will greatly depend on your actual service requirements.

Setup and Validation

To use Cowbird in a project, first you need to install it. To do so, please follow steps in Installation and Configuration procedures.

After this, you should be able to call the CLI CLI Utilities to validate it is installed properly using:

cowbird --help

Web Application

To start the Web Application, you can simply run the following command:

make start

This will first install any missing dependencies in the current environment (see Installation), and will after start a basic Web Application on localhost:7000 with default configurations. Please refer to Configuration if any of the parameters needs adjustment for custom environments.

For running the application, multiple WSGI HTTP Servers can be employed (e.g.: Gunicorn, Waitress, etc.). They usually all support as input an INI configuration file for specific settings. Cowbird also employs such INI file (cowbird.ini) to customize its behaviour. See Configuration for further details, and please refer to the employed WSGI application documentation of your liking for their respective setup requirements.

API

When the application is started, the Swagger API should be available under /api path. This will render the current version API and applicable requests. Please refer to this documentation to discover all provided API paths and events supported by Cowbird on a running instance (that could be older than latest code base). Alternatively, documentation of all versions is available on ReadTheDocs.

CLI

After successful Installation of Cowbird package, multiple helper CLI Utilities become available as CLI applications callable from the shell. These can be quite useful to run typical Cowbird events calls from the terminal without having to form corresponding HTTP requests. Please refer to the relevant page for further details.

Documentation

The documentation is automatically built by ReadTheDocs. It is generated from the documentation source, the parsing of Python docstrings within the code, the code itself, and the Cowbird REST API.

You can also preview the result by building the documentation locally using:

make docs

The resulting location will be printed on the terminal and can be opened in a web browser.

Testing

Tests are executed using a Web Application that gets spawned by a set of default configurations to run HTTP requests against.

Note

To customize execution parameters, you can export variables such as COWBIRD_INI_FILE_PATH for example, and they will be picked up to validate specific results against defined Configuration.

When adding new features or fixing bugs, it is recommended to execute linting checks and tests locally prior to opening a PR, as each PR gets tested and you will waste more time waiting for results to complete then if ran locally.

To validate linting of the code, simply call:

make check

To run all tests locally, simply execute the following command:

make test

Coverage analysis with the same set of tests is also available using:

make coverage

You can also run subsets of tests according to markers and/or specific test function pytest specification using:

make SPEC="<CUSTOM TEST SPECIFICATIONS>" test-custom

Or some of the predefined filters:

make test-api
make test-cli

Finally, the following command can be executed to built and run a smoke test of the resulting Docker image:

make test-docker

Installation

Basic Setup

At the command line:

make install

This will create a conda environment named cowbird, and install all required dependencies of the package in it. You should be ready to employ Cowbird with example Configuration files at this point.

Advanced

To install in another environment, CONDA_ENV_NAME can be provided to make.

Otherwise, following can be used to install with whichever python is detected (up to user to manage references):

make install-pkg

If you want the full setup for development (including dependencies for test execution), use:

make install-dev

Configuration

At startup, Cowbird application will load multiple configuration files to define various behaviours or setup operations. These are defined through the configuration settings presented in sections below.

All generic Cowbird configuration settings can be defined through either the cowbird.ini file or environment variables. Values defined in cowbird.ini are expected to follow the cowbird.[variable_name] format, and corresponding COWBIRD_[VARIABLE_NAME] format is used for environment variables. Both of these alternatives match the constants defined in cowbird/constants.py and can be used interchangeably.

Configuration Files

File: cowbird.ini

This is the base configuration file that defines most of Cowbird’s lower level application configuration (API, CLI). A basic cowbird.example.ini configuration is provided, which should allow any user to run the application locally. It is recommended to create a copy of this file as cowbird.ini to customize settings to your linking (this file is ignored for repository commits).

Furthermore, this file is used by default in each tagged Docker image, and mounted at ${COWBIRD_CONFIG_DIR}/cowbird.ini location. If you want to provide different configuration, the file should be overridden in the Docker image using a volume mount parameter, or by specifying an alternative path through the environment variable COWBIRD_INI_FILE_PATH.

File: config.yml

This is the core configuration file that defines most of Cowbird’s data configuration which it must work with to manage Handler components. A basic config.example.yml file is provided, for sample definition of expected schemas per handler.

This config file contains the following required sections :

handlers:

The handlers section contains the definition of managed handlers by Cowbird. Each handler is provided as a string that must match an actual implementation in Cowbird. Each handler must be further configured with one or more of the following parameters. If a required parameter is missing for a handler it will throw a HandlerConfigurationException exception. Additional parameters can be used for some handlers, such as admin_user and admin_password for a Magpie handler.

Parameters :

Parameter name

Default value

Description

active

False

Bool allowing to deactivate a handler and stop managing it.

priority

math.inf

Relative priority between handlers while handling events. Lower values have higher priority, default value is last.

url

None

URI of the web service represented by this Cowbird handler. Some Cowbird handlers do not represent web services, but others will throw an exception if missing.

workspace_dir

None

Location of the users workspace root. Required for the following handlers : FileSystem, Catalog and Geoserver.

Example :

handlers:
  Magpie:
    active: true
    url: https://${HOSTNAME}/magpie
    admin_user: ${MAGPIE_ADMIN_USER}
    admin_password: ${MAGPIE_ADMIN_PASSWORD}
  FileSystem:
    active: true
    priority: 1
    workspace_dir: ${WORKSPACE_DIR}
    jupyterhub_user_data_dir: ${JUPYTERHUB_USER_DATA_DIR}
sync_permissions:

This section defines how to synchronize permissions between services when they share resources. This is used only for the synchronization of permissions between Magpie services/resources. The sync_permissions are defined first by a list of Magpie services and their associated resources, defined in the services section below. The mappings defining how the resources should be synchronized are described in the other section permissions_mapping.

services

This section contains the different resources that can be synchronized, ordered by service. The services found in this section of the config should also exist in Magpie.

See also

For more details on available services on Magpie, refer to these pages :

Each service defines a list of resource keys, which are custom names that define a resource path. They should correspond to the names used in the permissions_mapping section below. Each resource path contains the list of its segments, with their corresponding name and type.

The name of a segment can either be a string name, a variable or a MULTI_TOKEN (**).

Variables are indicated by a name written between braces (ex.: {variable_name}) and represent a single segment name. A variable can be reused across different resource paths if they have a matching segment name. A resource path can use any number of different variables, but each variable can only be used one time per resource path. They are useful to indicate the corresponding location of the resource segment in a mapped permission. Note that all variables found in a target resource path should also be included in the source resource path.

MULTI_TOKEN represent any number (0 or more) of names that fit with the corresponding type. Also, the MULTI_TOKEN can only be used one time in each list of path segments. This is to avoid ambiguous cases that would result with using multiple MULTI_TOKEN, since multiple ways of matching the resource path would then be possible. For example with a tokenized path **/** and an input resource seg1/seg2/seg3, multiple choices of matching are possible. We could match seg1/seg2 with the first token, and seg3 with the second token, we could also match seg1 with the first token, and seg2/seg3 with the second token, etc.

The variables and tokens are useful to know the type of any segments that doesn’t have a fixed name.

permissions_mapping

This section defines an array of permissions mapping between services. Each item found in the permissions_mapping uses the following format :

"resource_key1 : <permissions1> <mapping> resource_key2 : <permissions2>"

The resource keys should correspond to resource keys defined in the services section above.

<permissionsX> is defined as a single permission or a list of permissions :

permission | [permission1, permission2, ...]

<mapping> is defined as a unidirectional or bidirectional arrow :

-> | <- | <->

Each of the permissions can either use an implicit format (<name> or <name>-match) or an explicit format (<name>-<access>-<scope>). When using an implicit format, if the access and/or scope are not specified, it will use the default access allow and/or the default scope recursive.

The arrows between the 2 resources indicate the direction of the synchronization, and which resources can be a source or target resource.

In the case of the <-> arrow, the synchronization of permissions can be done in either direction. Also, it is important to note that, in this case, both mapped resources should have matching variable names if any. This means each resource needs to match all the variables of the other mapped resource. Also, if one of the resource uses the MULTI_TOKEN, the other resource should also include it in its path, to know how to match the segments.

In the case of the -> or <- arrow, the synchronization is only done one way. In this case, the source resource path should include every variable names found in the target resource, but it can have more variables that just won’t be used in the target path. Also, if the target resource uses the MULTI_TOKEN, the source resource should have one too. The source can also use the ** token even if the target doesn’t include one.

In the case of a deleted webhook event, note that the related target permissions only get removed if they are not in another sync mapping as a target where the source permission still exists. Deleting the target permission would break that other sync mapping, having an existing source permission but a deleted target permission. Instead, a target permission only gets deleted when all related source permissions are also deleted. For example, with the following mappings :

A -> C
B -> C

or
[A,B] -> C

If the A -> C mapping was triggered for a deleted webhook event on A, the C target permission should only be deleted if both A and B permissions don’t exist. Else, the B -> C mapping would become invalid if B exists and C was deleted.

Settings and Constants

Environment variables can be used to define all following configurations (unless mentioned otherwise with [constant] keyword next to the parameter name). Most values are parsed as plain strings, unless they refer to an activable setting (e.g.: True or False), or when specified with more specific [<type>] notation.

Configuration variables will be used by Cowbird on startup unless prior definition is found within cowbird.ini. All variables (i.e.: non-[constant] parameters) can also be specified by their cowbird.[variable_name] setting counterpart as described at the start of the Configuration section.

Loading Settings

These settings can be used to specify where to find other settings through custom configuration files.

  • COWBIRD_MODULE_DIR [constant]

    Path to the top level cowbird module (ie: source code).

  • COWBIRD_ROOT [constant]

    Path to the containing directory of Cowbird. This corresponds to the directory where the repository was cloned or where the package was installed.

  • COWBIRD_CONFIG_DIR
    (Default: ${COWBIRD_ROOT}/config)

    Configuration directory where to look for cowbird.ini file.

  • COWBIRD_CONFIG_PATH [required]

    Explicit path where to find a config.yml configuration file to load at Cowbird startup.

    See also

    File: config.yml

  • COWBIRD_INI_FILE_PATH

    Specifies where to find the initialization file to run Cowbird application.

    Warning

    This variable ignores the setting/env-var resolution order since settings cannot be defined without firstly loading the file referenced by its value.

Application Settings

Following configuration parameters are used to define values that are employed by Cowbird after loading the Loading Settings. All cowbird.[variable_name] counterpart definitions are also available as described at the start of the Configuration section.

  • COWBIRD_URL
    (Default: "http://localhost:2001")

    Full hostname URL to use so that Cowbird can resolve his own running instance location.

    Note

    This value is notably useful to indicate the exposed proxy location where Cowbird should be invoked from within a server stack that integrates it.

  • COWBIRD_SSL_VERIFY
    (Default: true)

    Specify if requests should enable SSL verification (recommended, should be disabled only for testing purposes).

  • COWBIRD_REQUEST_TIMEOUT
    (Default: 5, in seconds)

    Specify the connection timeout to be used when sending requests.

  • COWBIRD_LOG_LEVEL
    (Default: INFO)

    Logging level of operations. Cowbird will first use the complete logging configuration found in cowbird.ini in order to define logging formatters and handler referencing to the logger_cowbird section. If this configuration fail to retrieve an explicit logging level, this configuration variable is used instead to prepare a basic logger, after checking if a corresponding cowbird.log_level setting was instead specified.

    Warning

    When setting DEBUG level or lower, Cowbird could potentially dump some sensitive information in logs. It is important to avoid this setting for production systems.

  • COWBIRD_LOG_PRINT
    (Default: False)

    Specifies whether Cowbird logging should also enforce printing the details to the console when using CLI Utilities. Otherwise, the configured logging methodology in cowbird.ini is used (which can also define a console handler).

  • COWBIRD_LOG_REQUEST
    (Default: True)

    Specifies whether Cowbird should log incoming request details.

    Note

    This can make Cowbird quite verbose if large quantity of requests are accomplished.

  • COWBIRD_LOG_EXCEPTION
    (Default: True)

    Specifies whether Cowbird should log a raised exception during a process execution.

Components Diagram

Cowbird Components

CLI Utilities

CLI Helpers and Commands

Multiple CLI helpers are provided.

The common functions provided allow invocation and result retrieval similar to the Web API, but from a terminal. The Configuration files must be available in default location, or provided as input to resolve operations.

Please refer to the corresponding usage detail of each helper by calling them with --help argument for more details. More specifically:

# display available helpers
cowbird --help

# display available commands of 'handlers' helper
cowbird handlers --help

# display specific arguments and options of 'list' command of 'handlers' helper
cowbird handlers list --help

The cowbird CLI should be available on your path directly following Installation of the package. When using an conda environment, you should activate it first to make the CLI available.

Source code of these helpers can be found here.

API Reference

This page contains auto-generated API reference documentation 1.

cowbird

Subpackages
cowbird.api
Subpackages
cowbird.api.handlers
Submodules
cowbird.api.handlers.views
Module Contents
Functions

get_handlers_view(request)

List all registered handlers.

get_handler_view(request)

Get handler details.

cowbird.api.handlers.views.get_handlers_view(request)[source]

List all registered handlers.

cowbird.api.handlers.views.get_handler_view(request)[source]

Get handler details.

Package Contents
Functions

get_logger(→ logging.Logger)

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when

includeme(config)

cowbird.api.handlers.get_logger(name: str, level: Optional[int] = None, force_stdout: bool = None, message_format: Optional[str] = None, datetime_format: Optional[str] = None)logging.Logger[source]

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is logging.NOTSET.

cowbird.api.handlers.includeme(config)[source]
cowbird.api.home
Submodules
cowbird.api.home.views
Module Contents
Functions

get_homepage(request)

Cowbird API homepage.

get_version(request)

Version of the API.

get_worker_version()

Attributes

LOGGER

cowbird.api.home.views.LOGGER[source]
cowbird.api.home.views.get_homepage(request)[source]

Cowbird API homepage.

cowbird.api.home.views.get_version(request)[source]

Version of the API.

cowbird.api.home.views.get_worker_version()[source]
Package Contents
Functions

get_logger(→ logging.Logger)

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when

includeme(config)

Attributes

LOGGER

cowbird.api.home.get_logger(name: str, level: Optional[int] = None, force_stdout: bool = None, message_format: Optional[str] = None, datetime_format: Optional[str] = None)logging.Logger[source]

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is logging.NOTSET.

cowbird.api.home.LOGGER[source]
cowbird.api.home.includeme(config)[source]
cowbird.api.swagger
Submodules
cowbird.api.swagger.views
Module Contents
Functions

api_swagger(request)

Swagger UI route to display the Cowbird REST API schemas.

api_schema(→ cowbird.typedefs.JSON)

Return JSON Swagger specifications of Cowbird REST API.

cowbird.api.swagger.views.api_swagger(request)[source]

Swagger UI route to display the Cowbird REST API schemas.

cowbird.api.swagger.views.api_schema(request: pyramid.request.Request)cowbird.typedefs.JSON[source]

Return JSON Swagger specifications of Cowbird REST API.

Package Contents
Functions

api_schema(→ cowbird.typedefs.JSON)

Return JSON Swagger specifications of Cowbird REST API.

api_swagger(request)

Swagger UI route to display the Cowbird REST API schemas.

get_logger(→ logging.Logger)

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when

includeme(config)

cowbird.api.swagger.api_schema(request: pyramid.request.Request)cowbird.typedefs.JSON[source]

Return JSON Swagger specifications of Cowbird REST API.

cowbird.api.swagger.api_swagger(request)[source]

Swagger UI route to display the Cowbird REST API schemas.

cowbird.api.swagger.get_logger(name: str, level: Optional[int] = None, force_stdout: bool = None, message_format: Optional[str] = None, datetime_format: Optional[str] = None)logging.Logger[source]

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is logging.NOTSET.

cowbird.api.swagger.includeme(config)[source]
cowbird.api.webhooks
Submodules
cowbird.api.webhooks.views
Module Contents
Functions

dispatch(handler_fct)

post_user_webhook_view(request)

User webhook used for created or removed user events.

post_permission_webhook_view(request)

Permission webhook used for created or removed permission events.

Attributes

LOGGER

cowbird.api.webhooks.views.LOGGER[source]
exception cowbird.api.webhooks.views.WebhookDispatchException[source]

Bases: Exception

Error indicating that an exception occurred during a webhook dispatch.

Initialize self. See help(type(self)) for accurate signature.

cowbird.api.webhooks.views.dispatch(handler_fct)[source]
cowbird.api.webhooks.views.post_user_webhook_view(request)[source]

User webhook used for created or removed user events.

cowbird.api.webhooks.views.post_permission_webhook_view(request)[source]

Permission webhook used for created or removed permission events.

Package Contents
Functions

get_logger(→ logging.Logger)

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when

includeme(config)

cowbird.api.webhooks.get_logger(name: str, level: Optional[int] = None, force_stdout: bool = None, message_format: Optional[str] = None, datetime_format: Optional[str] = None)logging.Logger[source]

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is logging.NOTSET.

cowbird.api.webhooks.includeme(config)[source]
Submodules
cowbird.api.exception
Module Contents
Functions

verify_param(→ None)

Evaluate various parameter combinations given the requested verification flags. Given a failing verification,

apply_param_content(→ cowbird.typedefs.JSON)

Formats and applies the failing parameter conditions and results to returned JSON content according to flags.

evaluate_call(→ Any)

Evaluates the specified call with a wrapped HTTP exception handling. On failure, tries to call.

valid_http(…)

Returns successful HTTP with standardized information formatted with content type. (see raise_http() for HTTP

raise_http(→ NoReturn)

Raises error HTTP with standardized information formatted with content type.

validate_params(→ Tuple[int, str, cowbird.typedefs.JSON])

Validates parameter types and formats required by valid_http() and raise_http().

format_content_json_str(http_code, detail, content, …)

Inserts the code, details, content and type within the body using json format. Includes also any other specified

rewrite_content_type(→ Tuple[str, …)

Attempts to rewrite the type field inserted by various functions such as:

generate_response_http_format(…)

Formats the HTTP response content according to desired content_type using provided HTTP code and content.

Attributes

LOGGER

RAISE_RECURSIVE_SAFEGUARD_MAX

RAISE_RECURSIVE_SAFEGUARD_COUNT

PARAM_REGEX

EMAIL_REGEX

UUID_REGEX

URL_REGEX

INDEX_REGEX

cowbird.api.exception.LOGGER[source]
cowbird.api.exception.RAISE_RECURSIVE_SAFEGUARD_MAX = 5[source]
cowbird.api.exception.RAISE_RECURSIVE_SAFEGUARD_COUNT = 0[source]
cowbird.api.exception.PARAM_REGEX = ^[A-Za-z0-9]+(?:[\s_\-\.][A-Za-z0-9]+)*$[source]
cowbird.api.exception.EMAIL_REGEX[source]
cowbird.api.exception.UUID_REGEX[source]
cowbird.api.exception.URL_REGEX[source]
cowbird.api.exception.INDEX_REGEX = ^[0-9]+$[source]
cowbird.api.exception.verify_param(param: Ellipsis, param_compare: Optional[Union[Any, List[Any]]] = None, param_name: Optional[str] = None, param_content: Optional[cowbird.typedefs.JSON] = None, with_param: bool = True, http_error: Type[pyramid.httpexceptions.HTTPError] = HTTPBadRequest, http_kwargs: Optional[cowbird.typedefs.ParamsType] = None, msg_on_fail: str = '', content: Optional[cowbird.typedefs.JSON] = None, content_type: str = CONTENT_TYPE_JSON, not_none: bool = False, not_empty: bool = False, not_in: bool = False, not_equal: bool = False, is_true: bool = False, is_false: bool = False, is_none: bool = False, is_empty: bool = False, is_in: bool = False, is_equal: bool = False, is_type: bool = False, matches: bool = False)None[source]

Evaluate various parameter combinations given the requested verification flags. Given a failing verification, directly raises the specified http_error. Invalid usage exceptions generated by this verification process are treated as HTTPInternalServerError. Exceptions are generated using the standard output method.

Parameters
  • param – parameter value to evaluate

  • param_compare – Other value(s) to test param against. Can be an iterable (single value resolved as iterable unless None). To test for None type, use is_none/not_none flags instead.

  • param_name – name of the tested parameter returned in response if specified for debugging purposes

  • param_content – Additional JSON content to apply to generated error content on raise when with_param is True. Must be JSON serializable. Provided content can override generated error parameter if matching fields.

  • with_param – On raise, adds values of param, param_name and param_compare, as well as additional failing conditions metadata to the JSON response body for each of the corresponding value.

  • http_error – derived exception to raise on test failure (default: HTTPBadRequest)

  • http_kwargs – additional keyword arguments to pass to http_error called in case of HTTP exception

  • msg_on_fail – message details to return in HTTP exception if flag condition failed

  • content – json formatted additional content to provide in case of exception

  • content_type – format in which to return the exception (one of cowbird.common.SUPPORTED_ACCEPT_TYPES)

  • not_none – test that param is not None type

  • not_empty – test that param is not an empty iterable (string, list, set, etc.)

  • not_in – test that param does not exist in param_compare values

  • not_equal – test that param is not equal to param_compare value

  • is_true – test that param is True

  • is_false – test that param is False

  • is_none – test that param is None type

  • is_empty – test param for an empty iterable (string, list, set, etc.)

  • is_in – test that param exists in param_compare values

  • is_equal – test that param equals param_compare value

  • is_type – test that param is of same type as specified by param_compare type

  • matches – test that param matches the regex specified by param_compare value

Raises
  • HTTPError – if tests fail, specified exception is raised (default: HTTPBadRequest)

  • HTTPInternalServerError – for evaluation error

Returns

nothing if all tests passed

cowbird.api.exception.apply_param_content(content: Ellipsis, param: Any, param_compare: Any, param_name: str, with_param: bool, param_content: Optional[cowbird.typedefs.JSON], needs_compare: bool, needs_iterable: bool, is_type: bool, fail_conditions: cowbird.typedefs.JSON)cowbird.typedefs.JSON[source]

Formats and applies the failing parameter conditions and results to returned JSON content according to flags.

See also

verify_param()

cowbird.api.exception.evaluate_call(call: Ellipsis, fallback: Optional[Callable[], None]] = None, http_error: Type[pyramid.httpexceptions.HTTPError] = HTTPInternalServerError, http_kwargs: Optional[cowbird.typedefs.ParamsType] = None, msg_on_fail: str = '', content: Optional[cowbird.typedefs.JSON] = None, content_type: str = CONTENT_TYPE_JSON)Any[source]

Evaluates the specified call with a wrapped HTTP exception handling. On failure, tries to call.

fallback if specified, and finally raises the specified http_error.

Any potential error generated by fallback or http_error themselves are treated as HTTPInternalServerError.

Exceptions are generated using the standard output method formatted based on specified content_type.

Example:

normal call:

try:
    res = func(args)
except Exception as exc:
    fb_func()
    raise HTTPExcept(exc.message)

wrapped call:

res = evaluate_call(lambda: func(args), fallback=lambda: fb_func(), http_error=HTTPExcept, **kwargs)
Parameters
  • call – function to call, MUST be specified as lambda: <function_call>

  • fallback – function to call (if any) when call failed, MUST be lambda: <function_call>

  • http_error – alternative exception to raise on call failure

  • http_kwargs – additional keyword arguments to pass to http_error if called in case of HTTP exception

  • msg_on_fail – message details to return in HTTP exception if call failed

  • content – json formatted additional content to provide in case of exception

  • content_type – format in which to return the exception (one of cowbird.common.SUPPORTED_ACCEPT_TYPES)

Raises
  • http_error – on call failure

  • HTTPInternalServerError – on fallback failure

Returns

whichever return value call might have if no exception occurred

cowbird.api.exception.valid_http(http_success: Ellipsis = HTTPOk, http_kwargs: Optional[cowbird.typedefs.ParamsType] = None, detail: Optional[str] = '', content: Optional[cowbird.typedefs.JSON] = None, content_type: Optional[str] = CONTENT_TYPE_JSON)Union[pyramid.httpexceptions.HTTPSuccessful, pyramid.httpexceptions.HTTPRedirection][source]

Returns successful HTTP with standardized information formatted with content type. (see raise_http() for HTTP error calls)

Parameters
  • http_success – any derived class from valid HTTP codes (<400) (default: HTTPOk)

  • http_kwargs – additional keyword arguments to pass to http_success when called

  • detail – additional message information (default: empty)

  • content – json formatted content to include

  • content_type – format in which to return the exception (one of cowbird.utils.SUPPORTED_ACCEPT_TYPES)

Returns

formatted successful response with additional details and HTTP code

cowbird.api.exception.raise_http(http_error: Ellipsis = HTTPInternalServerError, http_kwargs: Optional[cowbird.typedefs.ParamsType] = None, detail: str = '', content: Optional[cowbird.typedefs.JSON] = None, content_type: str = CONTENT_TYPE_JSON, nothrow: bool = False)NoReturn[source]

Raises error HTTP with standardized information formatted with content type.

The content contains the corresponding http error code, the provided message as detail and optional specified additional json content (kwarg dict).

See also

valid_http() for HTTP successful calls

Parameters
  • http_error – any derived class from base HTTPError (default: HTTPInternalServerError)

  • http_kwargs – additional keyword arguments to pass to http_error if called in case of HTTP exception

  • detail – additional message information (default: empty)

  • content – json formatted content to include

  • content_type – format in which to return the exception (one of cowbird.utils.SUPPORTED_ACCEPT_TYPES)

  • nothrow – returns the error response instead of raising it automatically, but still handles execution errors

Raises

HTTPError – formatted raised exception with additional details and HTTP code

Returns

HTTPError formatted exception with additional details and HTTP code only if nothrow is True

cowbird.api.exception.validate_params(http_class: Ellipsis, http_base: Union[Type[pyramid.httpexceptions.HTTPException], Iterable[Type[pyramid.httpexceptions.HTTPException]]], detail: str, content: Optional[cowbird.typedefs.JSON], content_type: str)Tuple[int, str, cowbird.typedefs.JSON][source]

Validates parameter types and formats required by valid_http() and raise_http().

Parameters
  • http_class – any derived class from base HTTPException to verify

  • http_base – any derived sub-class(es) from base HTTPException as minimum requirement for http_class (ie: 2xx, 4xx, 5xx codes). Can be a single class of an iterable of possible requirements (any).

  • detail – additional message information (default: empty)

  • content – json formatted content to include

  • content_type – format in which to return the exception (one of cowbird.utils.SUPPORTED_ACCEPT_TYPES)

Raises

HTTPInternalServerError – if any parameter is of invalid expected format

Returns http_code, detail, content

parameters with corrected and validated format if applicable

cowbird.api.exception.format_content_json_str(http_code, detail, content, content_type)[source]

Inserts the code, details, content and type within the body using json format. Includes also any other specified json formatted content in the body. Returns the whole json body as a single string for output.

Raises

HTTPInternalServerError – if parsing of the json content failed

Returns

formatted json content as string with added HTTP code and details

cowbird.api.exception.rewrite_content_type(content: Union[str, cowbird.typedefs.JSON], content_type: str)Tuple[str, Optional[cowbird.typedefs.JSON]][source]

Attempts to rewrite the type field inserted by various functions such as:

By applying the new value provided by content_type.

Returns

Content with rewritten “type” (if possible) and converted to string directly insertable to a response body. Also provides the converted JSON body if applicable (original content was literal JSON or JSON-like string).

cowbird.api.exception.generate_response_http_format(http_class: Type[pyramid.httpexceptions.HTTPException], http_kwargs: Optional[cowbird.typedefs.ParamsType], content: cowbird.typedefs.JSON, content_type: Optional[str] = CONTENT_TYPE_PLAIN, metadata: Optional[cowbird.typedefs.JSON] = None)pyramid.httpexceptions.HTTPException[source]

Formats the HTTP response content according to desired content_type using provided HTTP code and content.

Parameters
  • http_classHTTPException derived class to use for output (code, generic title/explanation, etc.)

  • http_kwargs – additional keyword arguments to pass to http_class when called

  • content – formatted JSON content or literal string content providing additional details for the response

  • content_type – one of cowbird.utils.SUPPORTED_ACCEPT_TYPES (default: cowbird.utils.CONTENT_TYPE_PLAIN)

  • metadata – request metadata to add to the response body. (see: cowbird.api.requests.get_request_info())

Returns

http_class instance with requested information and content type if creation succeeds

Raises

HTTPInternalServerError instance details about requested information and content type if creation fails

cowbird.api.generic
Module Contents
Functions

internal_server_error(…)

Overrides default HTTP.

not_found_or_method_not_allowed(…)

Overrides the default HTTPNotFound [404] by appropriate HTTPMethodNotAllowed [405] when applicable.

guess_target_format(→ Tuple[str, bool])

Guess the best applicable response Content-Type header according to request Accept header and format

validate_accept_header_tween(…)

Tween that validates that the specified request Accept header or format query (if any) is a supported one by

apply_response_format_tween(…)

Tween that obtains the request Accept header or format query (if any) to generate the response with the

get_exception_info(→ cowbird.typedefs.JSON)

Obtains additional exception content details about the response according to available information.

get_request_info(→ cowbird.typedefs.JSON)

Obtains additional content details about the request according to available information.

Attributes

LOGGER

cowbird.api.generic.LOGGER[source]
cowbird.api.generic.internal_server_error(request: pyramid.request.Request)pyramid.httpexceptions.HTTPException[source]

Overrides default HTTP.

cowbird.api.generic.not_found_or_method_not_allowed(request: pyramid.request.Request)pyramid.httpexceptions.HTTPException[source]

Overrides the default HTTPNotFound [404] by appropriate HTTPMethodNotAllowed [405] when applicable.

Not found response can correspond to underlying process operation not finding a required item, or a completely unknown route (path did not match any existing API definition). Method not allowed is more specific to the case where the path matches an existing API route, but the specific request method (GET, POST, etc.) is not allowed on this path.

Without this fix, both situations return [404] regardless.

cowbird.api.generic.guess_target_format(request: pyramid.request.Request)Tuple[str, bool][source]

Guess the best applicable response Content-Type header according to request Accept header and format query, or defaulting to CONTENT_TYPE_JSON.

Returns

tuple of matched MIME-type and where it was found (True: header, False: query)

cowbird.api.generic.validate_accept_header_tween(handler: Callable[[pyramid.request.Request], pyramid.response.Response], registry: pyramid.registry.Registry)Callable[[pyramid.request.Request], pyramid.response.Response][source]

Tween that validates that the specified request Accept header or format query (if any) is a supported one by the application and for the given context.

Raises

HTTPNotAcceptable – if desired Content-Type is not supported.

cowbird.api.generic.apply_response_format_tween(handler: Callable[[pyramid.request.Request], pyramid.httpexceptions.HTTPException], registry: pyramid.registry.Registry)Callable[[pyramid.request.Request], pyramid.response.Response][source]

Tween that obtains the request Accept header or format query (if any) to generate the response with the desired Content-Type.

The target Content-Type is expected to have been validated by validate_accept_header_tween() beforehand to handle not-acceptable errors.

The tween also ensures that additional request metadata extracted from get_request_info() is applied to the response body if not already provided by a previous operation.

cowbird.api.generic.get_exception_info(response: Union[pyramid.httpexceptions.HTTPException, pyramid.request.Request, pyramid.response.Response], content: Optional[cowbird.typedefs.JSON] = None, exception_details: bool = False)cowbird.typedefs.JSON[source]

Obtains additional exception content details about the response according to available information.

cowbird.api.generic.get_request_info(request: Union[pyramid.request.Request, pyramid.httpexceptions.HTTPException], default_message: Optional[str] = None, exception_details: bool = False)cowbird.typedefs.JSON[source]

Obtains additional content details about the request according to available information.

cowbird.api.requests
Module Contents
Functions

check_value(→ None)

Validates the value against specified type and pattern.

get_request_method_content(request)

get_multiformat_body_raw(→ Any)

Obtains the value of key element from the request body according to specified Content-Type header.

get_multiformat_body(→ str)

Obtains and validates the matched value under key element from the request body.

get_path_param(→ str)

Obtains the matched value located at the expected position of the specified path variable.

get_query_param(→ Any)

Retrieves a query string value by name (case insensitive), or returns the default if not present.

Attributes

LOGGER

cowbird.api.requests.LOGGER[source]
cowbird.api.requests.check_value(value: Any, param_name: str, check_type: Any = str, pattern: Optional[Union[str, bool]] = ax.PARAM_REGEX, http_error: Optional[Type[pyramid.httpexceptions.HTTPError]] = None, msg_on_fail: Optional[str] = None)None[source]

Validates the value against specified type and pattern.

Parameters
  • value – value to validate.

  • check_type – verify that parameter value is of specified type. Set to None to disable check.

  • pattern – regex pattern to validate the input with. If value evaluates to False, skip this kind of validation (default: ax.PARAM_REGEX).

  • param_name – path variable key.

  • http_error – derived exception to raise on check failure (default: HTTPUnprocessableEntity)

  • msg_on_fail – message details to return in HTTP exception if check failed (default: description message of UnprocessableEntityResponseSchema).

Returns

None.

Raises

HTTPError – if the key is not an applicable path variable for this request.

cowbird.api.requests.get_request_method_content(request)[source]
cowbird.api.requests.get_multiformat_body_raw(request: pyramid.request.Request, key: str, default: Optional[Any] = None)Any[source]

Obtains the value of key element from the request body according to specified Content-Type header.

cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Any = str, pattern: Optional[Union[str, bool]] = ax.PARAM_REGEX, http_error: Optional[Type[pyramid.httpexceptions.HTTPError]] = None, msg_on_fail: Optional[str] = None)str[source]

Obtains and validates the matched value under key element from the request body.

Parsing of the body is accomplished according to Content-Type header.

Parameters
  • request – request from which to retrieve the key.

  • key – body key variable.

  • default – value to return instead if not found. If this default is None, it will raise.

  • check_type – verify that parameter value is of specified type. Set to None to disable check.

  • pattern – regex pattern to validate the input with. If value evaluates to False, skip this kind of validation (default: cowbird.api.exception.PARAM_REGEX).

  • http_error – derived exception to raise on check failure (default: HTTPUnprocessableEntity)

  • msg_on_fail – message details to return in HTTP exception if check failed (default: description message of UnprocessableEntityResponseSchema).

Returns

matched path variable value.

Raises
  • HTTPBadRequest – if the key could not be retrieved from the request body and has no provided default value.

  • HTTPUnprocessableEntity – if the retrieved value from the key is invalid for this request.

cowbird.api.requests.get_path_param(request: pyramid.request.Request, key: str, check_type: Any = str, pattern: Optional[Union[str, bool]] = ax.PARAM_REGEX, http_error: Optional[Type[pyramid.httpexceptions.HTTPError]] = None, msg_on_fail: Optional[str] = None)str[source]

Obtains the matched value located at the expected position of the specified path variable.

Parameters
  • request – request from which to retrieve the key.

  • key – path variable key.

  • check_type – verify that parameter value is of specified type. Set to None to disable check.

  • pattern – regex pattern to validate the input with. If value evaluates to False, skip this kind of validation (default: ax.PARAM_REGEX).

  • http_error – derived exception to raise on check failure (default: HTTPUnprocessableEntity)

  • msg_on_fail – message details to return in HTTP exception if check failed (default: description message of UnprocessableEntityResponseSchema).

Returns

matched path variable value.

Raises

HTTPError – if the key is not an applicable path variable for this request.

cowbird.api.requests.get_query_param(request: pyramid.request.Request, case_insensitive_key: Union[str, Iterable[str]], default: Optional[Any] = None)Any[source]

Retrieves a query string value by name (case insensitive), or returns the default if not present.

cowbird.api.schemas
Module Contents
Classes

ValidOperations

Valid values as webhook event.

Handler_RequestPathSchema

Fundamental building block of schemas.

AcceptType

Fundamental building block of schemas.

ContentType

Fundamental building block of schemas.

RequestHeaderSchemaAPI

Fundamental building block of schemas.

RequestHeaderSchemaUI

Fundamental building block of schemas.

QueryRequestSchemaAPI

Fundamental building block of schemas.

BaseRequestSchemaAPI

Fundamental building block of schemas.

HeaderResponseSchema

Fundamental building block of schemas.

BaseResponseSchemaAPI

Fundamental building block of schemas.

BaseResponseBodySchema

Fundamental building block of schemas.

ErrorVerifyParamConditions

Fundamental building block of schemas.

ErrorVerifyParamBodySchema

Fundamental building block of schemas.

ErrorFallbackBodySchema

Fundamental building block of schemas.

ErrorCallBodySchema

Fundamental building block of schemas.

ErrorResponseBodySchema

Fundamental building block of schemas.

InternalServerErrorResponseBodySchema

Fundamental building block of schemas.

BadRequestResponseSchema

Fundamental building block of schemas.

UnauthorizedResponseBodySchema

Fundamental building block of schemas.

UnauthorizedResponseSchema

Fundamental building block of schemas.

HTTPForbiddenResponseSchema

Fundamental building block of schemas.

NotFoundResponseSchema

Fundamental building block of schemas.

MethodNotAllowedResponseSchema

Fundamental building block of schemas.

NotAcceptableResponseSchema

Fundamental building block of schemas.

UnprocessableEntityResponseSchema

Fundamental building block of schemas.

InternalServerErrorResponseSchema

Fundamental building block of schemas.

PermissionSchema

Fundamental building block of schemas.

PermissionListSchema

Fundamental building block of schemas.

ResourceSchema

Fundamental building block of schemas.

ResourceListSchema

Fundamental building block of schemas.

HandlerSummarySchema

Fundamental building block of schemas.

HandlerListSchema

Fundamental building block of schemas.

HandlerConfigurationSchema

Fundamental building block of schemas.

HandlerDetailSchema

Fundamental building block of schemas.

Handlers_GET_RequestSchema

Fundamental building block of schemas.

Handlers_GET_ResponseBodySchema

Fundamental building block of schemas.

Handlers_GET_OkResponseSchema

Fundamental building block of schemas.

Handlers_GET_BadRequestResponseSchema

Fundamental building block of schemas.

Handlers_POST_RequestBodySchema

Fundamental building block of schemas.

Handlers_POST_RequestSchema

Fundamental building block of schemas.

Handlers_POST_CreatedResponseSchema

Fundamental building block of schemas.

Handlers_POST_BadRequestResponseSchema

Fundamental building block of schemas.

Handler_SummaryBodyResponseSchema

Fundamental building block of schemas.

Handler_GET_RequestSchema

Fundamental building block of schemas.

Handler_GET_ResponseBodySchema

Fundamental building block of schemas.

Handler_GET_OkResponseSchema

Fundamental building block of schemas.

Handler_GET_NotFoundResponseSchema

Fundamental building block of schemas.

Handlers_POST_ForbiddenResponseSchema

Fundamental building block of schemas.

Handlers_POST_ConflictResponseSchema

Fundamental building block of schemas.

Handlers_POST_UnprocessableEntityResponseSchema

Fundamental building block of schemas.

Handlers_POST_InternalServerErrorResponseSchema

Fundamental building block of schemas.

Handler_PATCH_RequestBodySchema

Fundamental building block of schemas.

Handler_PATCH_RequestSchema

Fundamental building block of schemas.

Handler_PATCH_ResponseBodySchema

Fundamental building block of schemas.

Handler_PATCH_OkResponseSchema

Fundamental building block of schemas.

Handler_PATCH_BadRequestResponseSchema

Fundamental building block of schemas.

Handler_PATCH_ForbiddenResponseSchema_ReservedKeyword

Fundamental building block of schemas.

Handler_PATCH_ForbiddenResponseSchema

Fundamental building block of schemas.

Handler_PATCH_UnprocessableEntityResponseSchema

Fundamental building block of schemas.

UserWebhook_POST_RequestBodySchema

Fundamental building block of schemas.

UserWebhook_POST_RequestSchema

Fundamental building block of schemas.

UserWebhook_POST_BadRequestResponseSchema

Fundamental building block of schemas.

UserWebhook_POST_OkResponseSchema

Fundamental building block of schemas.

UserWebhook_POST_InternalServerErrorResponseSchema

Fundamental building block of schemas.

PermissionWebhook_POST_RequestBodySchema

Fundamental building block of schemas.

PermissionWebhook_POST_RequestSchema

Fundamental building block of schemas.

PermissionWebhook_POST_BadRequestResponseSchema

Fundamental building block of schemas.

PermissionWebhook_POST_OkResponseSchema

Fundamental building block of schemas.

Version_GET_ResponseBodySchema

Fundamental building block of schemas.

Version_GET_OkResponseSchema

Fundamental building block of schemas.

FailedDependencyErrorResponseSchema

Fundamental building block of schemas.

Homepage_GET_OkResponseSchema

Fundamental building block of schemas.

SwaggerAPI_GET_OkResponseSchema

Fundamental building block of schemas.

Functions

get_security(service, method)

service_api_route_info(service_api, **kwargs)

Employed to simplify Pyramid route and view config definitions from same schema objects.

generate_api_schema(→ cowbird.typedefs.JSON)

Return JSON Swagger specifications of Cowbird REST API.

Attributes

TitleAPI

InfoAPI

SecurityCookieAuthAPI

SecurityDefinitionsAPI

SecurityAuthenticatedAPI

SecurityAdministratorAPI

SecurityEveryoneAPI

SwaggerGenerator

SwaggerAPI

VersionAPI

HomepageAPI

HandlersAPI

HandlerAPI

UserWebhookAPI

PermissionWebhookAPI

OperationParameter

HandlerNameParameter

APITag

WebhooksTag

HandlersTag

TAG_DESCRIPTIONS

Handlers_GET_responses

Handlers_POST_responses

Handler_GET_responses

Handler_PATCH_responses

UserWebhook_POST_responses

PermissionWebhook_POST_responses

Version_GET_responses

Homepage_GET_responses

SwaggerAPI_GET_responses

cowbird.api.schemas.TitleAPI[source]
cowbird.api.schemas.InfoAPI[source]
cowbird.api.schemas.SecurityCookieAuthAPI[source]
cowbird.api.schemas.SecurityDefinitionsAPI[source]
cowbird.api.schemas.SecurityAuthenticatedAPI[source]
cowbird.api.schemas.SecurityAdministratorAPI[source]
cowbird.api.schemas.SecurityEveryoneAPI[source]
cowbird.api.schemas.get_security(service, method)[source]
cowbird.api.schemas.service_api_route_info(service_api, **kwargs)[source]

Employed to simplify Pyramid route and view config definitions from same schema objects.

class cowbird.api.schemas.ValidOperations[source]

Bases: cowbird.utils.ExtendedEnum

Valid values as webhook event.

CreateOperation = created[source]
DeleteOperation = deleted[source]
cowbird.api.schemas.generate_api_schema(swagger_base_spec: Dict[str, Union[str, List[str]]])cowbird.typedefs.JSON[source]

Return JSON Swagger specifications of Cowbird REST API.

Uses Cornice Services and Schemas to return swagger specification.

Parameters

swagger_base_spec – dictionary that specifies the ‘host’ and list of HTTP ‘schemes’ to employ.

cowbird.api.schemas.SwaggerGenerator[source]
cowbird.api.schemas.SwaggerAPI[source]
cowbird.api.schemas.VersionAPI[source]
cowbird.api.schemas.HomepageAPI[source]
cowbird.api.schemas.HandlersAPI[source]
cowbird.api.schemas.HandlerAPI[source]
cowbird.api.schemas.UserWebhookAPI[source]
cowbird.api.schemas.PermissionWebhookAPI[source]
cowbird.api.schemas.OperationParameter[source]
cowbird.api.schemas.HandlerNameParameter[source]
class cowbird.api.schemas.Handler_RequestPathSchema(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

handler_name[source]
cowbird.api.schemas.APITag = API[source]
cowbird.api.schemas.WebhooksTag = Webhooks[source]
cowbird.api.schemas.HandlersTag = Handlers[source]
cowbird.api.schemas.TAG_DESCRIPTIONS[source]
class cowbird.api.schemas.AcceptType(*arg, **kw)[source]

Bases: colander.SchemaNode

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

schema_type[source]
default[source]
example[source]
missing[source]
class cowbird.api.schemas.ContentType(*arg, **kw)[source]

Bases: colander.SchemaNode

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

schema_type[source]
name = Content-Type[source]
default[source]
example[source]
missing[source]
class cowbird.api.schemas.RequestHeaderSchemaAPI(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

accept[source]
content_type[source]
class cowbird.api.schemas.RequestHeaderSchemaUI(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

content_type[source]
class cowbird.api.schemas.QueryRequestSchemaAPI(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

format[source]
class cowbird.api.schemas.BaseRequestSchemaAPI(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

header[source]
querystring[source]
class cowbird.api.schemas.HeaderResponseSchema(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

content_type[source]
class cowbird.api.schemas.BaseResponseSchemaAPI(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

header[source]
class cowbird.api.schemas.BaseResponseBodySchema(code, description, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

class cowbird.api.schemas.ErrorVerifyParamConditions(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

not_none[source]
not_empty[source]
not_in[source]
not_equal[source]
is_none[source]
is_empty[source]
is_in[source]
is_equal[source]
is_true[source]
is_false[source]
is_type[source]
matches[source]
class cowbird.api.schemas.ErrorVerifyParamBodySchema(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

name[source]
value[source]
compare[source]
conditions[source]
class cowbird.api.schemas.ErrorFallbackBodySchema(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

exception[source]
error[source]
class cowbird.api.schemas.ErrorCallBodySchema(*arg, **kw)[source]

Bases: ErrorFallbackBodySchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

detail[source]
content[source]
class cowbird.api.schemas.ErrorResponseBodySchema(code, description, **kw)[source]

Bases: BaseResponseBodySchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

route_name[source]
request_url[source]
method[source]
param[source]
call[source]
fallback[source]
class cowbird.api.schemas.InternalServerErrorResponseBodySchema(**kw)[source]

Bases: ErrorResponseBodySchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

class cowbird.api.schemas.BadRequestResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Required value for request is missing.[source]
body[source]
class cowbird.api.schemas.UnauthorizedResponseBodySchema(**kw)[source]

Bases: ErrorResponseBodySchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

route_name[source]
request_url[source]
class cowbird.api.schemas.UnauthorizedResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Unauthorized access to this resource. Missing authentication headers or cookies.[source]
body[source]
class cowbird.api.schemas.HTTPForbiddenResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Forbidden operation for this resource or insufficient user privileges.[source]
body[source]
class cowbird.api.schemas.NotFoundResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = The route resource could not be found.[source]
body[source]
class cowbird.api.schemas.MethodNotAllowedResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = The method is not allowed for this resource.[source]
body[source]
class cowbird.api.schemas.NotAcceptableResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Unsupported Content-Type in 'Accept' header was specified.[source]
body[source]
class cowbird.api.schemas.UnprocessableEntityResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Invalid value specified.[source]
body[source]
class cowbird.api.schemas.InternalServerErrorResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Internal Server Error. Unhandled exception occurred.[source]
body[source]
class cowbird.api.schemas.PermissionSchema(*arg, **kw)[source]

Bases: colander.SchemaNode

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Managed permission under a service.[source]
schema_type[source]
example = test-permission[source]
class cowbird.api.schemas.PermissionListSchema(*args, **kw)[source]

Bases: colander.SequenceSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = List of managed permissions under a service.[source]
permission[source]
class cowbird.api.schemas.ResourceSchema(*arg, **kw)[source]

Bases: colander.SchemaNode

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Managed resource under a service.[source]
schema_type[source]
example = test-resource[source]
class cowbird.api.schemas.ResourceListSchema(*args, **kw)[source]

Bases: colander.SequenceSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = List of managed resources under a service.[source]
resource[source]
class cowbird.api.schemas.HandlerSummarySchema(*arg, **kw)[source]

Bases: colander.SchemaNode

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Managed handler.[source]
schema_type[source]
example = test-handler[source]
class cowbird.api.schemas.HandlerListSchema(*args, **kw)[source]

Bases: colander.SequenceSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = List of managed handlers.[source]
handler[source]
class cowbird.api.schemas.HandlerConfigurationSchema(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Custom configuration of the handler. Expected format and fields specific to each handler type.[source]
missing[source]
default[source]
class cowbird.api.schemas.HandlerDetailSchema(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

name[source]
type[source]
url[source]
resources[source]
permissions[source]
class cowbird.api.schemas.Handlers_GET_RequestSchema(*arg, **kw)[source]

Bases: BaseRequestSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

class cowbird.api.schemas.Handlers_GET_ResponseBodySchema(code, description, **kw)[source]

Bases: BaseResponseBodySchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

handlers[source]
class cowbird.api.schemas.Handlers_GET_OkResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Get handlers successful.[source]
body[source]
class cowbird.api.schemas.Handlers_GET_BadRequestResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Invalid handler name.[source]
body[source]
class cowbird.api.schemas.Handlers_POST_RequestBodySchema(*arg, **kw)[source]

Bases: HandlerDetailSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

class cowbird.api.schemas.Handlers_POST_RequestSchema(*arg, **kw)[source]

Bases: BaseRequestSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

body[source]
class cowbird.api.schemas.Handlers_POST_CreatedResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Handler creation successful.[source]
body[source]
class cowbird.api.schemas.Handlers_POST_BadRequestResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Invalid value parameters for handler creation.[source]
body[source]
class cowbird.api.schemas.Handler_SummaryBodyResponseSchema(code, description, **kw)[source]

Bases: BaseResponseBodySchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

handler[source]
class cowbird.api.schemas.Handler_GET_RequestSchema(*arg, **kw)[source]

Bases: BaseRequestSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

path[source]
class cowbird.api.schemas.Handler_GET_ResponseBodySchema(code, description, **kw)[source]

Bases: BaseResponseBodySchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

handler[source]
class cowbird.api.schemas.Handler_GET_OkResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Get handler successful.[source]
body[source]
class cowbird.api.schemas.Handler_GET_NotFoundResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Could not find specified handler.[source]
body[source]
class cowbird.api.schemas.Handlers_POST_ForbiddenResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Handler registration forbidden.[source]
body[source]
class cowbird.api.schemas.Handlers_POST_ConflictResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Specified 'handler_name' value already exists.[source]
body[source]
class cowbird.api.schemas.Handlers_POST_UnprocessableEntityResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Handler creation for registration failed.[source]
body[source]
class cowbird.api.schemas.Handlers_POST_InternalServerErrorResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Handler registration status could not be validated.[source]
body[source]
class cowbird.api.schemas.Handler_PATCH_RequestBodySchema(*arg, **kw)[source]

Bases: HandlerDetailSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

class cowbird.api.schemas.Handler_PATCH_RequestSchema(*arg, **kw)[source]

Bases: BaseRequestSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

path[source]
body[source]
class cowbird.api.schemas.Handler_PATCH_ResponseBodySchema(code, description, **kw)[source]

Bases: Handler_GET_ResponseBodySchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

class cowbird.api.schemas.Handler_PATCH_OkResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Update handler successful.[source]
body[source]
class cowbird.api.schemas.Handler_PATCH_BadRequestResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Registered handler values are already equal to update values.[source]
body[source]
class cowbird.api.schemas.Handler_PATCH_ForbiddenResponseSchema_ReservedKeyword(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Update handler name to 'types' not allowed (reserved keyword).[source]
body[source]
class cowbird.api.schemas.Handler_PATCH_ForbiddenResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Update handler failed during value assignment.[source]
body[source]
class cowbird.api.schemas.Handler_PATCH_UnprocessableEntityResponseSchema(*arg, **kw)[source]

Bases: Handlers_POST_UnprocessableEntityResponseSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

class cowbird.api.schemas.UserWebhook_POST_RequestBodySchema(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

event[source]
user_name[source]
callback_url[source]
class cowbird.api.schemas.UserWebhook_POST_RequestSchema(*arg, **kw)[source]

Bases: BaseRequestSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

body[source]
class cowbird.api.schemas.UserWebhook_POST_BadRequestResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Invalid value parameters for user webhook.[source]
body[source]
class cowbird.api.schemas.UserWebhook_POST_OkResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = User event successfully handled.[source]
body[source]
class cowbird.api.schemas.UserWebhook_POST_InternalServerErrorResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Failed to handle user webhook event.[source]
body[source]
class cowbird.api.schemas.PermissionWebhook_POST_RequestBodySchema(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

event[source]
service_name[source]
resource_id[source]
resource_full_name[source]
name[source]
access[source]
scope[source]
user[source]
group[source]
class cowbird.api.schemas.PermissionWebhook_POST_RequestSchema(*arg, **kw)[source]

Bases: BaseRequestSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

body[source]
class cowbird.api.schemas.PermissionWebhook_POST_BadRequestResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Invalid value parameters for permission webhook.[source]
body[source]
class cowbird.api.schemas.PermissionWebhook_POST_OkResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Permission event successfully handled.[source]
body[source]
class cowbird.api.schemas.Version_GET_ResponseBodySchema(code, description, **kw)[source]

Bases: BaseResponseBodySchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

version[source]
worker_version[source]
db_version[source]
version_detail[source]
class cowbird.api.schemas.Version_GET_OkResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Get version successful.[source]
body[source]
class cowbird.api.schemas.FailedDependencyErrorResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Version dependencies could not all be identified.[source]
body[source]
class cowbird.api.schemas.Homepage_GET_OkResponseSchema(*arg, **kw)[source]

Bases: BaseResponseSchemaAPI

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description = Get homepage successful.[source]
body[source]
class cowbird.api.schemas.SwaggerAPI_GET_OkResponseSchema(*arg, **kw)[source]

Bases: colander.MappingSchema

Fundamental building block of schemas.

The constructor accepts these positional arguments:

  • typ: The ‘type’ for this node. It should be an instance of a class that implements the colander.interfaces.Type interface. If typ is not passed, a call to the schema_type() method on this class is made to get a default type. (When subclassing, schema_type() should be overridden to provide a reasonable default type).

  • *children: a sequence of subnodes. If the subnodes of this node are not known at construction time, they can later be added via the add method.

The constructor accepts these keyword arguments:

  • name: The name of this node.

  • typ: The ‘type’ for this node can optionally be passed in as a keyword argument. See the documentation for the positional arg above.

  • default: The default serialization value for this node when not set. If default is colander.drop, the node will be dropped from schema serialization. If not provided, the node will be serialized to colander.null.

  • missing: The default deserialization value for this node. If it is not provided, the missing value of this node will be the special marker value colander.required, indicating that it is considered ‘required’. When missing is colander.required, the required computed attribute will be True. When missing is colander.drop, the node is dropped from the schema if it isn’t set during deserialization.

  • missing_msg: Optional error message to be used if the value is required and missing.

  • preparer: Optional preparer for this node. It should be an object that implements the colander.interfaces.Preparer interface.

  • validator: Optional validator for this node. It should be an object that implements the colander.interfaces.Validator interface.

  • after_bind: A callback which is called after a clone of this node has ‘bound’ all of its values successfully. This callback is useful for performing arbitrary actions to the cloned node, or direct children of the cloned node (such as removing or adding children) at bind time. A ‘binding’ is the result of an execution of the bind method of the clone’s prototype node, or one of the parents of the clone’s prototype nodes. The deepest nodes in the node tree are bound first, so the after_bind methods of the deepest nodes are called before the shallowest. The after_bind callback should accept two values: node and kw. node will be a clone of the bound node object, kw will be the set of keywords passed to the bind method.

  • title: The title of this node. Defaults to a titleization of the name (underscores replaced with empty strings and the first letter of every resulting word capitalized). The title is used by higher-level systems (not by Colander itself).

  • description: The description for this node. Defaults to '' (the empty string). The description is used by higher-level systems (not by Colander itself).

  • widget: The ‘widget’ for this node. Defaults to None. The widget attribute is not interpreted by Colander itself, it is only meaningful to higher-level systems such as Deform.

  • insert_before: if supplied, it names a sibling defined by a superclass for its parent node; the current node will be inserted before the named node. It is not useful unless a mapping schema is inherited from another mapping schema, and you need to control the ordering of the resulting nodes.

Arbitrary keyword arguments remaining will be attached to the node object unmolested.

description[source]
header[source]
body[source]
cowbird.api.schemas.Handlers_GET_responses[source]
cowbird.api.schemas.Handlers_POST_responses[source]
cowbird.api.schemas.Handler_GET_responses[source]
cowbird.api.schemas.Handler_PATCH_responses[source]
cowbird.api.schemas.UserWebhook_POST_responses[source]
cowbird.api.schemas.PermissionWebhook_POST_responses[source]
cowbird.api.schemas.Version_GET_responses[source]
cowbird.api.schemas.Homepage_GET_responses[source]
cowbird.api.schemas.SwaggerAPI_GET_responses[source]
Package Contents
Functions

get_logger(→ logging.Logger)

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when

includeme(config)

Include API sub-modules.

cowbird.api.get_logger(name: str, level: Optional[int] = None, force_stdout: bool = None, message_format: Optional[str] = None, datetime_format: Optional[str] = None)logging.Logger[source]

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is logging.NOTSET.

cowbird.api.includeme(config)[source]

Include API sub-modules.

Each should defined an includeme function with further sub-modules to include, and every one of their relative views and routes.

cowbird.cli
Submodules
cowbird.cli.handlers

Cowbird CLI helper to execute handler operations.

Module Contents
Functions

make_parser(→ argparse.ArgumentParser)

main(→ cowbird.cli.utils.ParseResult)

cowbird.cli.handlers.make_parser(shared_parsers: cowbird.cli.utils.SharedParsers = None, prefixes: cowbird.cli.utils.CommandPrefixes = None)argparse.ArgumentParser[source]
cowbird.cli.handlers.main(args: cowbird.cli.utils.ParserArgs = None, parser: cowbird.cli.utils.HelperParser = None, namespace: cowbird.cli.utils.ParsedArgs = None)cowbird.cli.utils.ParseResult[source]
cowbird.cli.utils
Module Contents
Functions

subparser_help(→ Dict[str, str])

Generates both fields with the same description as each parameter is used in different context.

get_config_parser(→ argparse.ArgumentParser)

get_logger_parser(→ argparse.ArgumentParser)

set_log_level(→ None)

get_format_parser(→ argparse.ArgumentParser)

print_format(data, fmt[, section])

Attributes

CommandPrefixes

cowbird.cli.utils.CommandPrefixes[source]
cowbird.cli.utils.subparser_help(description: str, parent_parser: Optional[argparse.ArgumentParser] = None)Dict[str, str][source]

Generates both fields with the same description as each parameter is used in different context.

Field help is printed next to the subparser name when parent parser is called with --help. Field description populates the help details under the usage command when calling child parser --help.

cowbird.cli.utils.get_config_parser()argparse.ArgumentParser[source]
cowbird.cli.utils.get_logger_parser()argparse.ArgumentParser[source]
cowbird.cli.utils.set_log_level(args: argparse.Namespace, logger: Optional[logging.Logger] = None)None[source]
cowbird.cli.utils.get_format_parser()argparse.ArgumentParser[source]
cowbird.cli.utils.print_format(data, fmt, section=None)[source]
Package Contents
Functions

get_logger_parser(→ argparse.ArgumentParser)

subparser_help(→ Dict[str, str])

Generates both fields with the same description as each parameter is used in different context.

get_logger(→ logging.Logger)

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when

main([args])

Automatically groups all sub-helper CLI listed in cowbird.cli as a common cowbird CLI entrypoint.

Attributes

LOGGER

cowbird.cli.get_logger_parser()argparse.ArgumentParser[source]
cowbird.cli.subparser_help(description: str, parent_parser: Optional[argparse.ArgumentParser] = None)Dict[str, str][source]

Generates both fields with the same description as each parameter is used in different context.

Field help is printed next to the subparser name when parent parser is called with --help. Field description populates the help details under the usage command when calling child parser --help.

cowbird.cli.get_logger(name: str, level: Optional[int] = None, force_stdout: bool = None, message_format: Optional[str] = None, datetime_format: Optional[str] = None)logging.Logger[source]

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is logging.NOTSET.

cowbird.cli.LOGGER[source]
cowbird.cli.main(args=None)[source]

Automatically groups all sub-helper CLI listed in cowbird.cli as a common cowbird CLI entrypoint.

Dispatches the provided arguments to the appropriate sub-helper CLI as requested. Each sub-helper CLI must implement functions make_parser and main to generate the arguments and dispatch them to the corresponding caller.

cowbird.database

Database package for pyramid.

Add the database in the pyramid registry and a property db for the requests.

Submodules
cowbird.database.base
Module Contents
Classes

DatabaseInterface

Return the unique identifier of db type matching settings.

class cowbird.database.base.DatabaseInterface(_: cowbird.typedefs.AnySettingsContainer)[source]

Return the unique identifier of db type matching settings.

Database interface defining a minimum set of function mostly around store management.

__slots__ = ['type'][source]
static _get_store_type(store_type: cowbird.typedefs.StoreSelector)str[source]
abstract get_store(store_type, *store_args, **store_kwargs)[source]
abstract reset_store(store_type: cowbird.typedefs.StoreSelector)None[source]
abstract get_session()[source]
abstract get_information()cowbird.typedefs.JSON[source]
Returns

{‘version’: version, ‘type’: db_type}

abstract is_ready()bool[source]
cowbird.database.mongodb
Module Contents
Classes

MongoDatabase

Return the unique identifier of db type matching settings.

Functions

get_mongodb_connection(→ pymongo.database.Database)

Obtains the basic database connection from settings.

get_mongodb_engine(→ pymongo.database.Database)

Obtains the database with configuration ready for usage.

Attributes

MongoDB

MongodbStores

AnyMongodbStore

cowbird.database.mongodb.MongoDB :Optional[Database][source]
cowbird.database.mongodb.MongodbStores[source]
cowbird.database.mongodb.AnyMongodbStore[source]
class cowbird.database.mongodb.MongoDatabase(container: cowbird.typedefs.AnySettingsContainer)[source]

Bases: cowbird.database.base.DatabaseInterface

Return the unique identifier of db type matching settings.

Initialize the mongo database from various type of container.

_database[source]
_settings[source]
_stores[source]
type = mongodb[source]
reset_store(store_type)[source]
get_store(store_type: Union[str, Type[cowbird.database.stores.StoreInterface], AnyMongodbStoreType], *store_args: Any, **store_kwargs: Any)AnyMongodbStore[source]

Retrieve a store from the database.

Parameters
  • store_type – type of the store to retrieve/create.

  • store_args – additional arguments to pass down to the store.

  • store_kwargs – additional keyword arguments to pass down to the store.

get_session()Any[source]
get_information()cowbird.typedefs.JSON[source]
Returns

{‘version’: version, ‘type’: db_type}

is_ready()bool[source]
cowbird.database.mongodb.get_mongodb_connection(container: cowbird.typedefs.AnySettingsContainer)pymongo.database.Database[source]

Obtains the basic database connection from settings.

cowbird.database.mongodb.get_mongodb_engine(container: cowbird.typedefs.AnySettingsContainer)pymongo.database.Database[source]

Obtains the database with configuration ready for usage.

cowbird.database.stores

Stores to read/write data to from/to MongoDB using pymongo.

Module Contents
Classes

StoreInterface

Check that the store implementation defines its type and index_fields.

MongodbStore

Base class extended by all concrete store implementations.

MonitoringStore

Registry for monitoring instances.

Attributes

LOGGER

cowbird.database.stores.LOGGER[source]
class cowbird.database.stores.StoreInterface[source]

Bases: object

Check that the store implementation defines its type and index_fields.

type[source]
index_fields = [][source]
class cowbird.database.stores.MongodbStore(collection: pymongo.collection.Collection)[source]

Base class extended by all concrete store implementations.

Validate and hold the collection for all the implementation.

classmethod get_args_kwargs(*args: Any, **kwargs: Any)Tuple[Tuple, Dict][source]

Filters MongodbStore-specific arguments to safely pass them down its __init__.

class cowbird.database.stores.MonitoringStore(*args, **kwargs)[source]

Bases: StoreInterface, MongodbStore

Registry for monitoring instances.

Uses MongoDB to store what is monitored and by whom.

Init the store used to save monitors.

type = monitors[source]
index_fields = ['callback', 'path'][source]
save_monitor(monitor: cowbird.monitoring.monitor.Monitor)None[source]

Stores Monitor in MongoDB storage.

delete_monitor(monitor: cowbird.monitoring.monitor.Monitor)None[source]

Removes Monitor from MongoDB storage.

list_monitors()List[cowbird.monitoring.monitor.Monitor][source]

Lists all Monitor in MongoDB storage.

clear_services()None[source]

Removes all Monitor from MongoDB storage.

Package Contents
Classes

MongoDatabase

Return the unique identifier of db type matching settings.

Functions

get_registry(→ Optional[pyramid.registry.Registry])

Retrieves the application registry from various containers referencing to it.

get_settings(→ cowbird.typedefs.SettingsType)

Retrieve application settings from a supported container.

get_db(→ mongodb.MongoDatabase)

Obtains the database connection from configured application settings.

includeme(config)

Attributes

LOGGER

class cowbird.database.MongoDatabase(container: cowbird.typedefs.AnySettingsContainer)[source]

Bases: cowbird.database.base.DatabaseInterface

Return the unique identifier of db type matching settings.

Initialize the mongo database from various type of container.

_database
_settings
_stores
type = mongodb
reset_store(store_type)
get_store(store_type: Union[str, Type[cowbird.database.stores.StoreInterface], AnyMongodbStoreType], *store_args: Any, **store_kwargs: Any)AnyMongodbStore

Retrieve a store from the database.

Parameters
  • store_type – type of the store to retrieve/create.

  • store_args – additional arguments to pass down to the store.

  • store_kwargs – additional keyword arguments to pass down to the store.

get_session()Any
get_information()cowbird.typedefs.JSON
Returns

{‘version’: version, ‘type’: db_type}

is_ready()bool
cowbird.database.get_registry(container: cowbird.typedefs.AnyRegistryContainer, nothrow: bool = False)Optional[pyramid.registry.Registry][source]

Retrieves the application registry from various containers referencing to it.

cowbird.database.get_settings(container: Optional[cowbird.typedefs.AnySettingsContainer], app: bool = False)cowbird.typedefs.SettingsType[source]

Retrieve application settings from a supported container.

Parameters
  • container – supported container with an handle to application settings.

  • app – allow retrieving from current thread registry if no container was defined.

Returns

found application settings dictionary.

Raises

TypeError – when no application settings could be found or unsupported container.

cowbird.database.LOGGER[source]
cowbird.database.get_db(container: cowbird.typedefs.AnySettingsContainer, reset_connection: bool = False)mongodb.MongoDatabase[source]

Obtains the database connection from configured application settings.

If reset_connection is True, the container must be the application Registry or any container that can retrieve it to accomplish reference reset. Otherwise, any settings container can be provided.

cowbird.database.includeme(config)[source]
cowbird.handlers
Subpackages
cowbird.handlers.impl
Submodules
cowbird.handlers.impl.catalog
Module Contents
Classes

Catalog

Keep the catalog index in sync when files are created/deleted/updated.

Attributes

LOGGER

cowbird.handlers.impl.catalog.LOGGER[source]
class cowbird.handlers.impl.catalog.Catalog(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]

Bases: cowbird.handlers.handler.Handler, cowbird.monitoring.fsmonitor.FSMonitor

Keep the catalog index in sync when files are created/deleted/updated.

Create the catalog instance.

Parameters
  • settings – Cowbird settings for convenience

  • name – Handler name

required_params[source]
abstract get_resource_id(resource_full_name: str)str[source]

Each handler must provide this implementation required by the permission synchronizer.

The function needs to find the resource id in Magpie from the resource full name using its knowledge of the service. If the resource doesn’t already exist, the function needs to create it, again using its knowledge of resource type and parent resource type if required.

user_created(user_name)[source]
user_deleted(user_name)[source]
abstract permission_created(permission)[source]
abstract permission_deleted(permission)[source]
static get_instance()[source]

Return the Catalog singleton instance from the class name used to retrieve the FSMonitor from the DB.

on_created(filename)[source]

Call when a new file is found.

Parameters

filename – Relative filename of a new file

on_deleted(filename)[source]

Call when a file is deleted.

Parameters

filename – Relative filename of the removed file

on_modified(filename)[source]

Call when a file is updated.

Parameters

filename – Relative filename of the updated file

cowbird.handlers.impl.filesystem
Module Contents
Classes

FileSystem

Keep the proper directory structure in sync with the platform.

Attributes

LOGGER

NOTEBOOKS_DIR_NAME

cowbird.handlers.impl.filesystem.LOGGER[source]
cowbird.handlers.impl.filesystem.NOTEBOOKS_DIR_NAME = notebooks[source]
class cowbird.handlers.impl.filesystem.FileSystem(settings: cowbird.typedefs.SettingsType, name: str, jupyterhub_user_data_dir: str, **kwargs: Any)[source]

Bases: cowbird.handlers.handler.Handler

Keep the proper directory structure in sync with the platform.

Create the file system instance.

Parameters
  • settings – Cowbird settings for convenience

  • name – Handler name

  • jupyterhub_user_data_dir – Path to the JupyterHub user data directory, which will be symlinked to the working directory

required_params[source]
abstract get_resource_id(resource_full_name: str)str[source]

Each handler must provide this implementation required by the permission synchronizer.

The function needs to find the resource id in Magpie from the resource full name using its knowledge of the service. If the resource doesn’t already exist, the function needs to create it, again using its knowledge of resource type and parent resource type if required.

_get_user_workspace_dir(user_name)[source]
_get_jupyterhub_user_data_dir(user_name)[source]
user_created(user_name)[source]
user_deleted(user_name)[source]
abstract permission_created(permission)[source]
abstract permission_deleted(permission)[source]
cowbird.handlers.impl.geoserver
Module Contents
Classes

Geoserver

Keep Geoserver internal representation in sync with the platform.

Functions

geoserver_response_handling(func)

Decorator for response and logging handling for the different Geoserver HTTP requests.

create_workspace(_task, user_name)

create_datastore(_task, datastore_name)

remove_workspace(_task, workspace_name)

validate_shapefile(_task, workspace_name, shapefile_name)

publish_shapefile(_task, workspace_name, shapefile_name)

remove_shapefile(_task, workspace_name, shapefile_name)

Attributes

HANDLER_ADMIN_USER

HANDLER_ADMIN_PASSWORD

LOGGER

cowbird.handlers.impl.geoserver.HANDLER_ADMIN_USER = admin_user[source]
cowbird.handlers.impl.geoserver.HANDLER_ADMIN_PASSWORD = admin_password[source]
cowbird.handlers.impl.geoserver.LOGGER[source]
cowbird.handlers.impl.geoserver.geoserver_response_handling(func)[source]

Decorator for response and logging handling for the different Geoserver HTTP requests.

Parameters

func – Function executing a http request to Geoserver

Returns

Response object

class cowbird.handlers.impl.geoserver.Geoserver(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]

Bases: cowbird.handlers.handler.Handler, cowbird.monitoring.fsmonitor.FSMonitor

Keep Geoserver internal representation in sync with the platform.

Create the geoserver handler instance.

Parameters
  • settings – Cowbird settings for convenience

  • name – Handler name

required_params[source]
abstract get_resource_id(resource_full_name: str)str[source]

Each handler must provide this implementation required by the permission synchronizer.

The function needs to find the resource id in Magpie from the resource full name using its knowledge of the service. If the resource doesn’t already exist, the function needs to create it, again using its knowledge of resource type and parent resource type if required.

user_created(user_name)[source]
user_deleted(user_name)[source]
abstract permission_created(permission)[source]
abstract permission_deleted(permission)[source]
static get_instance()Geoserver[source]

Return the Geoserver singleton instance from the class name used to retrieve the FSMonitor from the DB.

on_created(filename)[source]

Call when a new file is found.

Parameters

filename – Relative filename of a new file

on_deleted(filename)[source]

Call when a file is deleted.

Parameters

filename – Relative filename of the removed file

on_modified(filename: str)None[source]

Call when a file is updated.

Parameters

filename – Relative filename of the updated file

create_workspace(name: Geoserver)None[source]

Create a new Geoserver workspace.

Parameters

name – Workspace name

remove_workspace(name: Geoserver)None[source]

Removes a workspace from geoserver. Will also remove all datastores associated with the workspace.

Parameters

name – Workspace name

create_datastore(workspace_name: Geoserver)None[source]

Create a new Geoserver workspace.

Parameters
  • self – Geoserver instance

  • workspace_name – Workspace name where the datastore must be created

publish_shapefile(workspace_name: Geoserver, shapefile_name: str)None[source]

Publish a shapefile in the specified workspace.

Parameters
  • workspace_name – Name of the workspace from which the shapefile will be published

  • shapefile_name – The shapefile’s name, without file extension

validate_shapefile(workspace_name, shapefile_name)[source]

Validate shapefile.

Will look for the three other files necessary for Geoserver publishing (.prj, .dbf, .shx) and raise a FileNotFoundError exception if one is missing.

Parameters
  • workspace_name – Name of the workspace from which the shapefile will be published

  • shapefile_name – The shapefile’s name, without file extension

remove_shapefile(workspace_name: Geoserver, filename: str)None[source]

Remove a shapefile from the specified workspace.

Parameters
  • workspace_name – Name of the workspace from which the shapefile will be removed

  • filename – The shapefile’s name, without file extension

static _get_shapefile_info(filename: str)Tuple[str, str][source]
Parameters

filename – Relative filename of a new file

Returns

Workspace name (str) where file is located and shapefile name (str)

static _get_datastore_name(workspace_name: str)str[source]

Return datastore name used to represent the datastore inside Geoserver.

To be used in the HTTP requests sent to Geoserver. This name does not exist on the file system.

_shapefile_folder_dir(workspace_name: str)str[source]

Returns the path to the user’s shapefile datastore inside the file system.

static _geoserver_user_datastore_dir(user_name: str)str[source]

Returns the path to the user’s shapefile datastore inside the Geoserver instance container.

Uses the WORKSPACE_DIR env variable mapped in the Geoserver container.

_create_workspace_request(workspace_name: Geoserver)requests.Response[source]

Request to create a new workspace.

Parameters

workspace_name – Name of workspace to be created

Returns

Response object

_remove_workspace_request(workspace_name: Geoserver)requests.Response[source]

Request to remove workspace and all associated datastores and layers.

Parameters

workspace_name – Name of workspace to remove

Returns

Response object

_create_datastore_dir(workspace_name: str)None[source]
_create_datastore_request(workspace_name: Geoserver, datastore_name: str)requests.Response[source]

Initial creation of the datastore with no connection parameters.

Parameters
  • workspace_name – Name of the workspace in which the datastore is created

  • datastore_name – Name of the datastore that will be created

Returns

Response object

_configure_datastore_request(workspace_name: Geoserver, datastore_name: str, datastore_path: str)requests.Response[source]

Configures the connection parameters of the datastore.

This is done as a secondary step because Geoserver tends to create the wrong type of datastore (shapefile instead of directory of shapefiles) when setting them at creation.

Parameters
  • workspace_name – Name of the workspace in which the datastore is created

  • datastore_name – Name of the datastore that will be created

Returns

Response object

_publish_shapefile_request(workspace_name: Geoserver, datastore_name: str, filename: str)requests.Response[source]

Request to publish a shapefile in Geoserver. Does so by creating a Feature type in Geoserver.

Parameters
  • workspace_name – Workspace where file will be published

  • datastore_name – Datastore where file will be published

  • filename – Name of the shapefile (with no extensions)

Returns

Response object

_remove_shapefile_request(workspace_name: Geoserver, datastore_name: str, filename: str)requests.Response[source]

Request to remove specified Geoserver Feature type and corresponding layer.

Parameters
  • workspace_name – Workspace where file is published

  • datastore_name – Datastore where file is published

  • filename – Name of the shapefile (with no extensions)

Returns

Response object

cowbird.handlers.impl.geoserver.create_workspace(_task, user_name)[source]
cowbird.handlers.impl.geoserver.create_datastore(_task, datastore_name)[source]
cowbird.handlers.impl.geoserver.remove_workspace(_task, workspace_name)[source]
cowbird.handlers.impl.geoserver.validate_shapefile(_task, workspace_name, shapefile_name)[source]
cowbird.handlers.impl.geoserver.publish_shapefile(_task, workspace_name, shapefile_name)[source]
cowbird.handlers.impl.geoserver.remove_shapefile(_task, workspace_name, shapefile_name)[source]
exception cowbird.handlers.impl.geoserver.GeoserverError[source]

Bases: Exception

Generic Geoserver error used to break request chains, as RequestTask only retries for a specific exception (RequestException).

Initialize self. See help(type(self)) for accurate signature.

cowbird.handlers.impl.magpie
Module Contents
Classes

Magpie

Complete the Magpie’s webhook call by calling Magpie temporary urls. Also keep service-shared resources in sync when

Attributes

LOGGER

COOKIES_TIMEOUT

cowbird.handlers.impl.magpie.LOGGER[source]
cowbird.handlers.impl.magpie.COOKIES_TIMEOUT = 60[source]
class cowbird.handlers.impl.magpie.Magpie(settings: cowbird.typedefs.SettingsType, name: str, admin_user: str, admin_password: str, **kwargs: Any)[source]

Bases: cowbird.handlers.handler.Handler

Complete the Magpie’s webhook call by calling Magpie temporary urls. Also keep service-shared resources in sync when permissions are updated for one of them.

** Cowbird components diagram 1.2.0 needs to be updated since Magpie can handle permissions synchronisation directly on permission update events. No need to handle them explicitly in nginx, thredds and geoserver classes.

Create the magpie instance and instantiate the permission synchronizer that will handle the permission events.

Parameters
  • settings – Cowbird settings for convenience

  • name – Handler name

  • admin_user – Magpie admin username used for login.

  • admin_password – Magpie admin password used for login.

required_params[source]
_send_request(method: str, url: str, params: Optional[Any] = None, json: Optional[Any] = None)requests.Response[source]

Wrapping function to send requests to Magpie, which also handles login and cookies.

get_service_types()List[source]

Returns the list of service types available on Magpie.

abstract get_resource_id(resource_full_name: str)str[source]

Each handler must provide this implementation required by the permission synchronizer.

The function needs to find the resource id in Magpie from the resource full name using its knowledge of the service. If the resource doesn’t already exist, the function needs to create it, again using its knowledge of resource type and parent resource type if required.

get_resources_tree(resource_id: int)List[source]

Returns the associated Magpie Resource object and all its parents in a list ordered from parent to child.

get_user_permissions(user: str)Dict[source]

Gets all user resource permissions.

get_group_permissions(grp: str)Dict[source]

Gets all group resource permissions.

abstract user_created(user_name)[source]
abstract user_deleted(user_name)[source]
permission_created(permission)[source]
permission_deleted(permission)[source]
create_permission(permissions_data: List[Dict[str, str]])None[source]

Make sure that the specified permission exists on Magpie.

delete_permission(permissions_data: List[Dict[str, str]])None[source]

Remove the specified permission from Magpie if it exists.

login()requests.cookies.RequestsCookieJar[source]

Login to Magpie app using admin credentials.

cowbird.handlers.impl.nginx
Module Contents
Classes

Nginx

Nothing to do right now.

class cowbird.handlers.impl.nginx.Nginx(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]

Bases: cowbird.handlers.handler.Handler

Nothing to do right now.

Create the nginx instance.

Parameters
  • settings – Cowbird settings for convenience

  • name – Handler name

required_params = [][source]
abstract get_resource_id(resource_full_name: str)str[source]

Each handler must provide this implementation required by the permission synchronizer.

The function needs to find the resource id in Magpie from the resource full name using its knowledge of the service. If the resource doesn’t already exist, the function needs to create it, again using its knowledge of resource type and parent resource type if required.

abstract user_created(user_name)[source]
abstract user_deleted(user_name)[source]
abstract permission_created(permission)[source]
abstract permission_deleted(permission)[source]
cowbird.handlers.impl.thredds
Module Contents
Classes

Thredds

Nothing to do right now.

class cowbird.handlers.impl.thredds.Thredds(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]

Bases: cowbird.handlers.handler.Handler

Nothing to do right now.

Create the thredds instance.

Parameters
  • settings – Cowbird settings for convenience

  • name – Handler name

required_params = [][source]
abstract get_resource_id(resource_full_name: str)str[source]

Each handler must provide this implementation required by the permission synchronizer.

The function needs to find the resource id in Magpie from the resource full name using its knowledge of the service. If the resource doesn’t already exist, the function needs to create it, again using its knowledge of resource type and parent resource type if required.

abstract user_created(user_name)[source]
abstract user_deleted(user_name)[source]
abstract permission_created(permission)[source]
abstract permission_deleted(permission)[source]
Submodules
cowbird.handlers.handler
Module Contents
Classes

Handler

Helper class that provides a standard way to create an ABC using

Attributes

AnyHandlerParameter

HANDLER_PRIORITY_PARAM

HANDLER_URL_PARAM

HANDLER_WORKSPACE_DIR_PARAM

HANDLER_PARAMETERS

LOGGER

cowbird.handlers.handler.AnyHandlerParameter[source]
cowbird.handlers.handler.HANDLER_PRIORITY_PARAM = priority[source]
cowbird.handlers.handler.HANDLER_URL_PARAM = url[source]
cowbird.handlers.handler.HANDLER_WORKSPACE_DIR_PARAM = workspace_dir[source]
cowbird.handlers.handler.HANDLER_PARAMETERS[source]
cowbird.handlers.handler.LOGGER[source]
exception cowbird.handlers.handler.HandlerConfigurationException[source]

Bases: Exception

Exception thrown when a handler cannot be instantiated because of a bad configuration.

Initialize self. See help(type(self)) for accurate signature.

class cowbird.handlers.handler.Handler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

Parameters
  • settings – Cowbird settings for convenience

  • name – Handler name

  • kwargs – The base class handle, but doesn’t require the following variables:

  • url – Location of the web service represented by the cowbird handler

  • workspace_dir – Workspace directory

  • priority – Relative priority between handlers while handling events. Lower value has higher priority, default value is last.

__slots__[source]

Handler interface used to notify implemented handlers of users/permissions changes.

Todo

At some point we will need a consistency function that goes through all Magpie users and make sure that handlers are up-to-date.

property required_paramsList[AnyHandlerParameter][source]
json()cowbird.typedefs.JSON[source]
_user_workspace_dir(user_name)[source]
abstract get_resource_id(resource_full_name: str)str[source]

Each handler must provide this implementation required by the permission synchronizer.

The function needs to find the resource id in Magpie from the resource full name using its knowledge of the service. If the resource doesn’t already exist, the function needs to create it, again using its knowledge of resource type and parent resource type if required.

abstract user_created(user_name)[source]
abstract user_deleted(user_name)[source]
abstract permission_created(permission)[source]
abstract permission_deleted(permission)[source]
cowbird.handlers.handler_factory
Module Contents
Classes

HandlerFactory

Create handler instance using handler name.

Attributes

LOGGER

VALID_HANDLERS

cowbird.handlers.handler_factory.LOGGER[source]
cowbird.handlers.handler_factory.VALID_HANDLERS = ['Catalog', 'Geoserver', 'Magpie', 'Nginx', 'Thredds', 'FileSystem'][source]
class cowbird.handlers.handler_factory.HandlerFactory[source]

Create handler instance using handler name.

create_handler(name: typing_extensions.Literal[Catalog])cowbird.handlers.impl.catalog.Catalog[source]
create_handler(name: typing_extensions.Literal[FileSystem])cowbird.handlers.impl.filesystem.FileSystem
create_handler(name: typing_extensions.Literal[Geoserver])cowbird.handlers.impl.geoserver.Geoserver
create_handler(name: typing_extensions.Literal[Magpie])cowbird.handlers.impl.magpie.Magpie
create_handler(name: typing_extensions.Literal[Nginx])cowbird.handlers.impl.nginx.Nginx
create_handler(name: typing_extensions.Literal[Thredds])cowbird.handlers.impl.thredds.Thredds
create_handler(name: str)Optional[cowbird.handlers.handler.Handler]

Instantiates a new Handler implementation using its name, overwriting an existing instance if required.

get_handler(name: typing_extensions.Literal[Catalog])cowbird.handlers.impl.catalog.Catalog[source]
get_handler(name: typing_extensions.Literal[FileSystem])cowbird.handlers.impl.filesystem.FileSystem
get_handler(name: typing_extensions.Literal[Geoserver])cowbird.handlers.impl.geoserver.Geoserver
get_handler(name: typing_extensions.Literal[Magpie])cowbird.handlers.impl.magpie.Magpie
get_handler(name: typing_extensions.Literal[Nginx])cowbird.handlers.impl.nginx.Nginx
get_handler(name: typing_extensions.Literal[Thredds])cowbird.handlers.impl.thredds.Thredds
get_handler(name: str)Optional[cowbird.handlers.handler.Handler]

Instantiates a Handler implementation using its name if it doesn’t exist or else returns the existing one from cache.

get_active_handlers()List[cowbird.handlers.handler.Handler][source]

Return a sorted list by priority of Handler implementation activated in the config.

Package Contents
Classes

HandlerFactory

Create handler instance using handler name.

Functions

get_handlers(→ List[handler.Handler])

Obtains the handlers managed by the application.

class cowbird.handlers.HandlerFactory[source]

Create handler instance using handler name.

create_handler(name: typing_extensions.Literal[Catalog])cowbird.handlers.impl.catalog.Catalog
create_handler(name: typing_extensions.Literal[FileSystem])cowbird.handlers.impl.filesystem.FileSystem
create_handler(name: typing_extensions.Literal[Geoserver])cowbird.handlers.impl.geoserver.Geoserver
create_handler(name: typing_extensions.Literal[Magpie])cowbird.handlers.impl.magpie.Magpie
create_handler(name: typing_extensions.Literal[Nginx])cowbird.handlers.impl.nginx.Nginx
create_handler(name: typing_extensions.Literal[Thredds])cowbird.handlers.impl.thredds.Thredds
create_handler(name: str)Optional[cowbird.handlers.handler.Handler]

Instantiates a new Handler implementation using its name, overwriting an existing instance if required.

get_handler(name: typing_extensions.Literal[Catalog])cowbird.handlers.impl.catalog.Catalog
get_handler(name: typing_extensions.Literal[FileSystem])cowbird.handlers.impl.filesystem.FileSystem
get_handler(name: typing_extensions.Literal[Geoserver])cowbird.handlers.impl.geoserver.Geoserver
get_handler(name: typing_extensions.Literal[Magpie])cowbird.handlers.impl.magpie.Magpie
get_handler(name: typing_extensions.Literal[Nginx])cowbird.handlers.impl.nginx.Nginx
get_handler(name: typing_extensions.Literal[Thredds])cowbird.handlers.impl.thredds.Thredds
get_handler(name: str)Optional[cowbird.handlers.handler.Handler]

Instantiates a Handler implementation using its name if it doesn’t exist or else returns the existing one from cache.

get_active_handlers()List[cowbird.handlers.handler.Handler]

Return a sorted list by priority of Handler implementation activated in the config.

cowbird.handlers.get_handlers(container: Optional[cowbird.typedefs.AnySettingsContainer] = None)List[handler.Handler][source]

Obtains the handlers managed by the application.

cowbird.monitoring
Submodules
cowbird.monitoring.fsmonitor
Module Contents
Classes

FSMonitor

Interface being called when something changes on the filesystem.

class cowbird.monitoring.fsmonitor.FSMonitor[source]

Bases: abc.ABC

Interface being called when something changes on the filesystem.

abstract static get_instance()[source]

Must return an instance of the class implementing FSMonitor.

abstract on_created(filename: str)None[source]

Call when a new file is found.

Parameters

filename – Relative filename of a new file

abstract on_deleted(filename: str)None[source]

Call when a file is deleted.

Parameters

filename – Relative filename of the removed file

abstract on_modified(filename: str)None[source]

Call when a file is updated.

Parameters

filename – Relative filename of the updated file

cowbird.monitoring.monitor
Module Contents
Classes

Monitor

Implementation of the watchdog FileSystemEventHandler class Allows to start/stop directory monitoring and

Attributes

LOGGER

cowbird.monitoring.monitor.LOGGER[source]
exception cowbird.monitoring.monitor.MonitorException[source]

Bases: Exception

Error indicating that a Monitor cannot be started because of an invalid path or callback.

Initialize self. See help(type(self)) for accurate signature.

class cowbird.monitoring.monitor.Monitor(path: str, recursive: bool, callback: Union[cowbird.monitoring.fsmonitor.FSMonitor, Type[cowbird.monitoring.fsmonitor.FSMonitor], str])[source]

Bases: watchdog.events.FileSystemEventHandler

Implementation of the watchdog FileSystemEventHandler class Allows to start/stop directory monitoring and send events to FSMonitor callback.

Initialize the path monitoring and ready to be started.

Parameters
  • path – Path to monitor

  • recursive – Monitor subdirectory recursively?

  • callback – Events are sent to this FSMonitor. Can be an object, a class type implementing FSMonitor or a string containing module and class name. The class type or string is used to instantiate an object using the class method FSMonitor.get_instance()

static get_fsmonitor_instance(callback: Union[cowbird.monitoring.fsmonitor.FSMonitor, Type[cowbird.monitoring.fsmonitor.FSMonitor], str])cowbird.monitoring.fsmonitor.FSMonitor[source]

Return a FSMonitor instance from multiple possible forms including the FSMonitor type, the FSMonitor full qualified class name or a direct instance which is returned as is.

static get_qualified_class_name(monitor: cowbird.monitoring.fsmonitor.FSMonitor)str[source]

Returns the full qualified class name of the FSMonitor object (string of the form module.class_name)

property recursive[source]
property path[source]
property callback[source]
property callback_instance[source]
property keyDict[source]

Return a dict that can be used as a unique key to identify this Monitor in a BD.

params()Dict[source]

Return a dict serializing this object from which a new Monitor can be recreated using the init function.

start()[source]

Start the monitoring so that events can be fired.

stop()[source]

Stop the monitoring so that events stop to be fired.

on_moved(event: Union[watchdog.events.DirMovedEvent, watchdog.events.FileMovedEvent])None[source]

Called when a file or a directory is moved or renamed.

Parameters

event – Event representing file/directory movement.

on_created(event: Union[watchdog.events.DirCreatedEvent, watchdog.events.FileCreatedEvent])None[source]

Called when a file or directory is created.

Parameters

event – Event representing file/directory creation.

on_deleted(event: Union[watchdog.events.DirDeletedEvent, watchdog.events.FileDeletedEvent])None[source]

Called when a file or directory is deleted.

Parameters

event – Event representing file/directory deletion.

on_modified(event: Union[watchdog.events.DirModifiedEvent, watchdog.events.FileModifiedEvent])None[source]

Called when a file or directory is modified.

Parameters

event – Event representing file/directory modification.

cowbird.monitoring.monitoring
Module Contents
Classes

Monitoring

Class handling file system monitoring and registering listeners.

Attributes

LOGGER

cowbird.monitoring.monitoring.LOGGER[source]
exception cowbird.monitoring.monitoring.MonitoringConfigurationException[source]

Bases: Exception

Exception thrown when the monitoring instance cannot be initialized because of a bad configuration.

Initialize self. See help(type(self)) for accurate signature.

class cowbird.monitoring.monitoring.Monitoring(config: cowbird.typedefs.AnySettingsContainer = None)[source]

Class handling file system monitoring and registering listeners.

Todo

At some point we will need a consistency function that goes through all monitored folder and make sure that monitoring handlers are up to date.

Initialize the monitoring instance from configured application settings.

Parameters

config – AnySettingsContainer object from which the db can be retrieved. The default value of None is only there to disable pylint E1120. The singleton instance must be initialized with a proper config and after that the init function should not be hit.

start()[source]

Load existing monitors and start the monitoring.

register(path: str, recursive: bool, cb_monitor: Union[cowbird.monitoring.fsmonitor.FSMonitor, Type[cowbird.monitoring.fsmonitor.FSMonitor], str])cowbird.monitoring.monitor.Monitor[source]

Register a monitor for a specific path and start it. If a monitor already exists for the specific path/cb_monitor combination it is directly returned. If this monitor was not recursively monitoring its path and the recursive flag is now true, this one take precedence and the monitor is updated accordingly. If the recursive flag was true and now it is false it has no effect.

Parameters
  • path – Path to monitor

  • recursive – Monitor subdirectory recursively?

  • cb_monitor – FSMonitor for which an instance is created and events are sent Can be an object, a class type implementing FSMonitor or a string containing module and class name.

Returns

The monitor registered or already existing for the specific path/cb_monitor combination.

unregister(path: str, cb_monitor: Union[cowbird.monitoring.fsmonitor.FSMonitor, Type[cowbird.monitoring.fsmonitor.FSMonitor], str])bool[source]

Stop a monitor and unregister it.

Parameters
  • path – Path used by the monitor

  • cb_monitor – FSMonitor object to remove Can be an object, a class type implementing FSMonitor or a string containing module and class name.

Returns

True if the monitor is found and successfully stopped, False otherwise

Submodules
cowbird.__meta__

General meta information on the package.

Module Contents
cowbird.__meta__.__version__ = 1.1.1[source]
cowbird.__meta__.__title__ = Cowbird[source]
cowbird.__meta__.__package__ = cowbird[source]
cowbird.__meta__.__author__ = Ouranos inc., CRIM[source]
cowbird.__meta__.__maintainer__ = Ouranos inc., CRIM[source]
cowbird.__meta__.__email__ =[source]
cowbird.__meta__.__url__ = https://github.com/Ouranosinc/cowbird[source]
cowbird.__meta__.__docker__ = https://hub.docker.com/r/pavics/cowbird[source]
cowbird.__meta__.__description__ = Cowbird is a middleware that manages interactions between various birds of the bird-house stack.[source]
cowbird.__meta__.__platforms__ = ['linux_x86_64'][source]
cowbird.__meta__.__natural_language__ = English[source]
cowbird.__meta__.__license__ = MIT[source]
cowbird.__meta__.__keywords__[source]
cowbird.app

Cowbird is a middleware that manages interactions between various birds of the bird-house stack.

Module Contents
Functions

get_app([global_config])

This function returns the Pyramid WSGI application.

main([global_config])

This function returns the Pyramid WSGI application.

Attributes

LOGGER

cowbird.app.LOGGER[source]
cowbird.app.get_app(global_config=None, **settings)[source]

This function returns the Pyramid WSGI application.

It can also be used for test purpose (some config needed only in pyramid and not in tests are still in the main)

cowbird.app.main(global_config=None, **settings)[source]

This function returns the Pyramid WSGI application.

cowbird.config
Module Contents
Functions

_load_config(→ cowbird.typedefs.ConfigDict)

Loads a file path or dictionary as YAML/JSON configuration.

get_all_configs(→ List[cowbird.typedefs.ConfigDict])

Loads all configuration files specified by the path (if a directory),

_expand_all(→ cowbird.typedefs.ConfigDict)

Applies environment variable expansion recursively to all applicable fields of a configuration definition.

validate_handlers_config_schema(→ None)

Validates the schema of the handlers section found in the config.

validate_sync_perm_config_schema(→ None)

Validates the schema of the sync_permissions section found in the config.

validate_and_get_resource_info(…)

Validates a resource_key and its related info from the config and returns some resource info relevant to the config

validate_bidirectional_mapping(→ None)

Validates if both resources of a bidirectional mapping respect validation rules.

validate_unidirectional_mapping(→ None)

Validates if both source and target resource of a unidirectional mapping respect validation rules.

get_mapping_info(→ Tuple[Union[str, Any], Ellipsis])

Obtain the different info found in a mapping string from the config.

get_permissions_from_str(→ List[str])

Returns a tuple of all permissions found in a string.

validate_sync_mapping_config(→ None)

Validates if mappings in the config have valid resource keys and use tokens properly.

validate_sync_config(→ None)

validate_sync_config_services(→ None)

Validates if all services used in the sync config are actual available services.

Attributes

LOGGER

MULTI_TOKEN

BIDIRECTIONAL_ARROW

RIGHT_ARROW

LEFT_ARROW

PERMISSION_REGEX

PERMISSIONS_REGEX

DIRECTION_REGEX

MAPPING_REGEX

NAMED_TOKEN_REGEX

cowbird.config.LOGGER[source]
cowbird.config.MULTI_TOKEN = **[source]
cowbird.config.BIDIRECTIONAL_ARROW = <->[source]
cowbird.config.RIGHT_ARROW = ->[source]
cowbird.config.LEFT_ARROW = <-[source]
cowbird.config.PERMISSION_REGEX = [\w-]+[source]
cowbird.config.PERMISSIONS_REGEX[source]
cowbird.config.DIRECTION_REGEX[source]
cowbird.config.MAPPING_REGEX[source]
cowbird.config.NAMED_TOKEN_REGEX = ^\{\s*(\w+)\s*\}$[source]
exception cowbird.config.ConfigError[source]

Bases: RuntimeError

Generic error during configuration loading.

Initialize self. See help(type(self)) for accurate signature.

exception cowbird.config.ConfigErrorInvalidTokens[source]

Bases: ConfigError

Config error specific to invalid SINGLE_TOKEN or MULTI_TOKEN tokens.

Initialize self. See help(type(self)) for accurate signature.

exception cowbird.config.ConfigErrorInvalidServiceKey[source]

Bases: ConfigError

Config error for invalid service keys.

Initialize self. See help(type(self)) for accurate signature.

exception cowbird.config.ConfigErrorInvalidResourceKey[source]

Bases: ConfigError

Config error for invalid resource keys.

Initialize self. See help(type(self)) for accurate signature.

cowbird.config._load_config(path_or_dict: Union[str, cowbird.typedefs.ConfigDict], section: str, allow_missing: bool = False)cowbird.typedefs.ConfigDict[source]

Loads a file path or dictionary as YAML/JSON configuration.

cowbird.config.get_all_configs(path_or_dict: Union[str, cowbird.typedefs.ConfigDict], section: str, allow_missing: bool = False)List[cowbird.typedefs.ConfigDict][source]

Loads all configuration files specified by the path (if a directory), a single configuration (if a file) or directly returns the specified dictionary section (if a configuration dictionary). :returns:

  • list of configurations loaded if input was a directory path

  • list of single configuration if input was a file path

  • list of single configuration if input was a JSON dict

  • empty list if none of the other cases where matched

Note

Order of file loading will be resolved by alphabetically sorted filename if specifying a directory path.

cowbird.config._expand_all(config: cowbird.typedefs.ConfigDict)cowbird.typedefs.ConfigDict[source]

Applies environment variable expansion recursively to all applicable fields of a configuration definition.

cowbird.config.validate_handlers_config_schema(handlers_cfg: cowbird.typedefs.ConfigDict)None[source]

Validates the schema of the handlers section found in the config.

cowbird.config.validate_sync_perm_config_schema(sync_cfg: cowbird.typedefs.ConfigDict)None[source]

Validates the schema of the sync_permissions section found in the config.

cowbird.config.validate_and_get_resource_info(res_key: str, segments: List[cowbird.typedefs.ConfigSegment])cowbird.typedefs.ConfigResTokenInfo[source]

Validates a resource_key and its related info from the config and returns some resource info relevant to the config mapping validation.

Returned info contains the following: - if the resource uses a MULTI_TOKEN in its resource_path - the list of named tokens found in the resource_path

cowbird.config.validate_bidirectional_mapping(mapping: str, res_info: Dict[str, cowbird.typedefs.ConfigResTokenInfo], res_key1: str, res_key2: str)None[source]

Validates if both resources of a bidirectional mapping respect validation rules.

Both should either use MULTI_TOKEN or not use it and both should use exactly the same named tokens.

cowbird.config.validate_unidirectional_mapping(mapping: str, src_info: cowbird.typedefs.ConfigResTokenInfo, tgt_info: cowbird.typedefs.ConfigResTokenInfo)None[source]

Validates if both source and target resource of a unidirectional mapping respect validation rules.

Source resource should use MULTI_TOKEN if target uses it, and source resource should include all named tokens found in the target resource.

cowbird.config.get_mapping_info(mapping: str)Tuple[Union[str, Any], Ellipsis][source]

Obtain the different info found in a mapping string from the config.

Returns the following matching groups : (res_key1, permission1, direction, res_key2, permission2)

cowbird.config.get_permissions_from_str(permissions: str)List[str][source]

Returns a tuple of all permissions found in a string.

Used for permission strings found in the config, which can either be a single permission or a list of permissions.

cowbird.config.validate_sync_mapping_config(sync_cfg: cowbird.typedefs.ConfigDict, res_info: Dict[str, cowbird.typedefs.ConfigResTokenInfo])None[source]

Validates if mappings in the config have valid resource keys and use tokens properly.

cowbird.config.validate_sync_config(sync_cfg: cowbird.typedefs.ConfigDict)None[source]
cowbird.config.validate_sync_config_services(sync_cfg: cowbird.typedefs.ConfigDict, available_services: List)None[source]

Validates if all services used in the sync config are actual available services.

All services should correspond to actual services available in Magpie.

cowbird.constants

Constant settings for Cowbird application.

Constants defined with format COWBIRD_[VARIABLE_NAME] can be matched with corresponding settings formatted as cowbird.[variable_name] in the cowbird.ini configuration file.

Note

Since the cowbird.ini file has to be loaded by the application to retrieve various configuration settings, constant COWBIRD_INI_FILE_PATH (or any other path variable defined before it - see below) has to be defined by environment variable if the default location is not desired (ie: if you want to provide your own configuration).

Module Contents
Functions

_get_default_log_level(→ AnyLogLevel)

Get logging level from INI configuration file or fallback to default INFO if it cannot be retrieved.

get_constant_setting_name(→ str)

Find the equivalent setting name of the provided environment variable name.

get_constant(→ cowbird.typedefs.SettingValue)

Search in order for matched value of constant_name:

validate_required(→ None)

Validates that some value is provided for every mandatory configuration setting.

Attributes

AnyLogLevel

COWBIRD_MODULE_DIR

COWBIRD_ROOT

COWBIRD_CONFIG_DIR

COWBIRD_CONFIG_PATH

COWBIRD_INI_FILE_PATH

COWBIRD_URL

COWBIRD_LOG_LEVEL

COWBIRD_LOG_PRINT

COWBIRD_LOG_REQUEST

COWBIRD_LOG_EXCEPTION

COWBIRD_ADMIN_PERMISSION

COWBIRD_CONSTANTS

_REGEX_ASCII_ONLY

_SETTING_SECTION_PREFIXES

_SETTINGS_REQUIRED

cowbird.constants.AnyLogLevel[source]
cowbird.constants.COWBIRD_MODULE_DIR[source]
cowbird.constants.COWBIRD_ROOT[source]
cowbird.constants.COWBIRD_CONFIG_DIR[source]
cowbird.constants.COWBIRD_CONFIG_PATH[source]
cowbird.constants.COWBIRD_INI_FILE_PATH[source]
cowbird.constants._get_default_log_level()AnyLogLevel[source]

Get logging level from INI configuration file or fallback to default INFO if it cannot be retrieved.

cowbird.constants.COWBIRD_URL[source]
cowbird.constants.COWBIRD_LOG_LEVEL[source]
cowbird.constants.COWBIRD_LOG_PRINT[source]
cowbird.constants.COWBIRD_LOG_REQUEST[source]
cowbird.constants.COWBIRD_LOG_EXCEPTION[source]
cowbird.constants.COWBIRD_ADMIN_PERMISSION = admin[source]
cowbird.constants.COWBIRD_CONSTANTS = ['COWBIRD_CONSTANTS', 'COWBIRD_MODULE_DIR', 'COWBIRD_ROOT', 'COWBIRD_ADMIN_PERMISSION'][source]
cowbird.constants._REGEX_ASCII_ONLY[source]
cowbird.constants._SETTING_SECTION_PREFIXES = ['cowbird'][source]
cowbird.constants._SETTINGS_REQUIRED = ['COWBIRD_URL', 'COWBIRD_CONFIG_PATH'][source]
cowbird.constants.get_constant_setting_name(name: str)str[source]

Find the equivalent setting name of the provided environment variable name.

Lower-case name and replace all non-ascii chars by _. Then, convert known prefixes with their dotted name.

cowbird.constants.get_constant(constant_name: Ellipsis, settings_container: Optional[cowbird.typedefs.AnySettingsContainer] = None, settings_name: Optional[str] = None, default_value: Optional[cowbird.typedefs.SettingValue] = None, raise_missing: bool = True, print_missing: bool = False, raise_not_set: bool = True)cowbird.typedefs.SettingValue[source]
Search in order for matched value of constant_name:
  1. search in COWBIRD_CONSTANTS

  2. search in settings if specified

  3. search alternative setting names (see below)

  4. search in cowbird.constants definitions

  5. search in environment variables

Parameter constant_name is expected to have the format COWBIRD_[VARIABLE_NAME] although any value can be passed to retrieve generic settings from all above mentioned search locations.

If settings_name is provided as alternative name, it is used as is to search for results if constant_name was not found. Otherwise, cowbird.[variable_name] is used for additional search when the format COWBIRD_[VARIABLE_NAME] was used for constant_name (i.e.: COWBIRD_ADMIN_USER will also search for cowbird.admin_user and so on for corresponding constants).

Parameters
  • constant_name – key to search for a value

  • settings_container – WSGI application settings container (if not provided, uses found one in current thread)

  • settings_name – alternative name for settings if specified

  • default_value – default value to be returned if not found anywhere, and exception raises are disabled.

  • raise_missing – raise exception if key is not found anywhere

  • print_missing – print message if key is not found anywhere, return None

  • raise_not_set – raise an exception if the found key is None, search until last case if others are None

Returns

found value or default_value

Raises
  • ValueError – if resulting value is invalid based on options (by default raise missing/None value)

  • LookupError – if no appropriate value could be found from all search locations (according to options)

cowbird.constants.validate_required(container: cowbird.typedefs.AnySettingsContainer)None[source]

Validates that some value is provided for every mandatory configuration setting.

Raises

when any of the requirements are missing a definition.

cowbird.permissions_synchronizer
Module Contents
Classes

Permission

Define every property required to set a permission in Magpie.

SyncPoint

A sync point contains services sharing resources via multiple APIs.

PermissionSynchronizer

Keep service-shared resources in sync when permissions are updated for one of them.

Attributes

SyncPointServicesType

LOGGER

SEGMENT_NAME_REGEX

RES_NAMETYPE_SEPARATOR

PERMISSION_DEFAULT_ACCESS

PERMISSION_DEFAULT_SCOPE

cowbird.permissions_synchronizer.SyncPointServicesType[source]
cowbird.permissions_synchronizer.LOGGER[source]
cowbird.permissions_synchronizer.SEGMENT_NAME_REGEX = [\w:-]+[source]
cowbird.permissions_synchronizer.RES_NAMETYPE_SEPARATOR = ::[source]
cowbird.permissions_synchronizer.PERMISSION_DEFAULT_ACCESS = allow[source]
cowbird.permissions_synchronizer.PERMISSION_DEFAULT_SCOPE = recursive[source]
class cowbird.permissions_synchronizer.Permission(service_name: Ellipsis, resource_id: str, resource_full_name: str, name: str, access: str, scope: str, user: str = None, group: str = None)[source]

Define every property required to set a permission in Magpie.

__eq__(other: Permission)bool[source]

Return self==value.

get_full_permission_value()str[source]

Returns the full permission value, consisting of the name-access-scope values.

class cowbird.permissions_synchronizer.SyncPoint(services: Ellipsis, permissions_mapping_list: SyncPointMappingType)[source]

A sync point contains services sharing resources via multiple APIs.

It defines how the same resource is defined in each service and what are the mapping between permission accesses.

Init the sync point, holding services with their respective resources root and how access are mapped between them.

Parameters
  • services – Dict containing the resource keys by service and all the names/types of each segment of those resource keys

  • permissions_mapping_list – List of strings representing a permission mapping between two resource keys

static _get_explicit_permission(permission: str)str[source]

Converts a permission that could use an implicit format (‘<name>’ or ‘<name>-match’) and converts it to use an explicit format (‘<name>-<access>-<scope>’).

_add_mapping(src_key: str, src_permissions: str, target_key: str, target_permissions: str)None[source]

Adds a source/target permission mapping to the object’s permissions mapping.

static _generate_regex_from_segments(res_segments: List[cowbird.typedefs.ConfigSegment])[source]

Generates a regex for a resource_nametype_path (ex.: /name1::type1/name2::type2) from a list of segments.

Returns the regex along with the count of segments in the regex that are named. This count excludes tokenized segments.

static _remove_type_from_nametype_path(nametype_path: str)str[source]

Removes the type from a nametype path (ex.: /name1::type1/name2::type2 becomes /name1/name2).

_find_matching_res(service_name: str, resource_nametype_path: str)[source]

Finds a resource key that matches the input resource path, in the sync_permissions config. Note that it returns the longest match and only the named segments of the path are included in the length value. Any tokenized segment is ignored in the length.

Parameters
  • service_name – Name of the service associated with the input resource.

  • resource_nametype_path – Full resource path name, which includes the type of each segment (ex.: /name1::type1/name2::type2)

static _create_res_data(target_segments: List[cowbird.typedefs.ConfigSegment], input_matched_groups: Dict[str, str])List[cowbird.typedefs.ResourceSegment][source]

Creates resource data, by replacing any tokens found in the segment names to their actual corresponding values. This data includes the name and type of each segments of a full resource path.

Parameters
  • target_segments – List containing the name and type info of each segment of the target resource path.

  • matched_groups

_get_resource_full_name_and_type(res_key: str, matched_groups: Dict[str, str])[source]

Finds the resource data from the config by using the resource key.

Returns the formatted resource data along with the related service name.

_get_src_permissions()Generator[Tuple[str, str]][source]

Yields all source resource/permissions found in the mappings.

static _is_in_permissions(target_permission: str, svc_name: str, src_res_full_name: cowbird.typedefs.ResourceSegment, permissions: Dict)bool[source]

Checks if a target permission is found in a permissions dict.

The check is done by looking for the target permission’s resource path in the permissions dict.

_filter_used_targets(target_res_and_permissions: Dict[str, List[str]], input_src_res_key: str, src_matched_groups: Dict[str, str], input_permission: Permission)[source]

Filters a dictionary of target resource/permissions, keeping only the permissions which should actually be removed.

This is used for the deleted webhook event, where all target permissions should not necessarily be synced. Any target permission that is also a target permission in another mapping and where the source permission of that other mapping still exists, should not be synced yet, since it would destroy that other mapping. Ex.:

A -> C
B -> C

or

[A,B] -> C

If the A -> C mapping was triggered for a deleted webhook event, the C target permission should only be synced if both A and B permissions don’t exist.

_get_permission_data(user_targets: Dict[str, List[str]], group_targets: Dict[str, List[str]], src_matched_groups: Dict[str, str], input_permission: Permission)cowbird.typedefs.PermissionData[source]

Formats permissions data to send to Magpie. Output contains, for each target resource key, the resource path (with the name of each segment and its corresponding type), and all the permissions to sync, defining for each permission, if it is on a user, a group, or both.

Output dict format :

{ <target_key>: {
    "res_path": [<list of segment names/types>],
    "permissions": { <permission_key>: [user, grp], ...}},
  ...
}
_prepare_permissions_to_remove(target_res_and_permissions: Dict[str, List[str]], input_permission: Permission, input_src_res_key: str, src_matched_groups: Dict[str, str])cowbird.typedefs.PermissionData[source]

Removes every source resource found in the mappings that has an existing permission that is synched to one of the input target permissions.

Used in the case of a deleted webhook event.

_find_permissions_to_sync(src_res_key: str, src_matched_groups: Dict[str, str], input_permission: Permission, perm_operation: Callable[[List[Dict]], None])cowbird.typedefs.PermissionData[source]

Finds all permissions that should be synchronised with the source resource.

sync(perm_operation: Callable[[List[Dict]], None], permission: Permission, src_resource_tree: List[Dict])None[source]

Create or delete target permissions, that are mapped to the source resource that triggered the event.

Parameters
  • perm_operation – Magpie create_permission or delete_permission function

  • permission – Permission to synchronize with others services

  • src_resource_tree – Resource tree associated with the permission to synchronize

class cowbird.permissions_synchronizer.PermissionSynchronizer(magpie_inst: cowbird.handlers.impl.magpie.Magpie)[source]

Bases: object

Keep service-shared resources in sync when permissions are updated for one of them.

Todo

At some point we will need a consistency function that goes through all permissions of all services and make sure that linked services have the same permissions.

create_permission(permission: Permission)None[source]

Create the same permission on each service sharing the same resource.

delete_permission(permission: Permission)None[source]

Delete the same permission on each service sharing the same resource.

cowbird.request_task
Module Contents
Classes

RequestTask

Celery base task that should be used to handle API requests.

exception cowbird.request_task.AbortException[source]

Bases: Exception

Exception raised when the chain must be interrupted.

Initialize self. See help(type(self)) for accurate signature.

class cowbird.request_task.RequestTask[source]

Bases: celery.app.task.Task, abc.ABC

Celery base task that should be used to handle API requests.

Using this class will set the following Task configuration :
  • auto-retry for every RequestException

  • backoff and jitter strategy

There is also an abort_chain function to stop the chain of requests in case of an unrecoverable event

To use this class simply decorate your asynchronous function like this:

from celery import shared_task

@shared_task(bind=True, base=RequestTask)
def function_name(self, any, wanted, parameters):
    pass  # function operations

Parameter bind=True will provide the self argument to the function which is the celery Task (not required).

Parameter base=RequestTask will instantiate a RequestTask rather than a base celery Task as the self object.

autoretry_for :Tuple[Exception][source]

Exceptions that are accepted as valid raising cases to attempt request retry.

retry_backoff = True[source]

Enable backoff strategy during request retry upon known raised exception.

retry_backoff_max = 600[source]

Maximum backoff delay permitted using request retry. Retries are abandoned if this delay is reached.

retry_jitter = True[source]

Enable jitter strategy during request retry upon known raised exception.

retry_kwargs[source]

Additional parameters to be passed down to requests for retry control.

abort_chain()[source]

Calling this function from a task will prevent any downstream tasks to be run after it.

cowbird.typedefs

Additional typing definitions.

Module Contents
cowbird.typedefs.Number[source]
cowbird.utils
Module Contents
Classes

ExtendedEnum

Utility enum.Enum methods.

SingletonMeta

A metaclass that creates a Singleton base class when called.

NullType

Represents a null value to differentiate from None.

Functions

get_logger(→ logging.Logger)

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when

set_logger_config(→ logging.Logger)

Applies the provided logging configuration settings to the logger.

print_log(→ None)

Logs the requested message to the logger and optionally enforce printing to the console according to configuration

raise_log(→ NoReturn)

Logs the provided message to the logger and raises the corresponding exception afterwards.

bool2str(→ str)

Converts value to explicit "true" or "false" str with permissive variants comparison

islambda(→ bool)

Evaluate if argument is a callable lambda expression.

configure_celery(config, config_ini)

get_app_config(→ pyramid.config.Configurator)

Generates application configuration with all required utilities and settings configured.

get_settings_from_config_ini(config_ini_path[, section])

Loads configuration INI settings with additional handling.

get_registry(→ Optional[pyramid.registry.Registry])

Retrieves the application registry from various containers referencing to it.

get_json(response)

Retrieves the ‘JSON’ body of a response using the property/callable according to the response’s implementation.

get_header(→ Optional[str])

Retrieves header_name by fuzzy match (independently of upper/lower-case and underscore/dash) from various

convert_response(→ pyramid.response.Response)

Converts a requests.Response object to an equivalent pyramid.response.Response object.

get_settings(→ cowbird.typedefs.SettingsType)

Retrieve application settings from a supported container.

fully_qualified_name(→ str)

Obtains the '<module>.<name>' full path definition of the object to allow finding and importing it.

log_request_format(→ str)

log_request(→ None)

Subscriber event that logs basic details about the incoming requests.

log_exception_tween(handler, registry)

Tween factory that logs any exception before re-raising it.

is_json_body(→ bool)

is_null(item)

get_config_path(→ str)

get_ssl_verify(→ bool)

get_timeout(→ int)

Attributes

CONTENT_TYPE_ANY

CONTENT_TYPE_JSON

CONTENT_TYPE_FORM

CONTENT_TYPE_HTML

CONTENT_TYPE_PLAIN

CONTENT_TYPE_APP_XML

CONTENT_TYPE_TXT_XML

FORMAT_TYPE_MAPPING

SUPPORTED_ACCEPT_TYPES

SUPPORTED_FORMAT_TYPES

KNOWN_CONTENT_TYPES

CLI_MODE_CFG

USE_TEST_CELERY_APP_CFG

LOGGER

null

cowbird.utils.CONTENT_TYPE_ANY = */*[source]
cowbird.utils.CONTENT_TYPE_JSON = application/json[source]
cowbird.utils.CONTENT_TYPE_FORM = application/x-www-form-urlencoded[source]
cowbird.utils.CONTENT_TYPE_HTML = text/html[source]
cowbird.utils.CONTENT_TYPE_PLAIN = text/plain[source]
cowbird.utils.CONTENT_TYPE_APP_XML = application/xml[source]
cowbird.utils.CONTENT_TYPE_TXT_XML = text/xml[source]
cowbird.utils.FORMAT_TYPE_MAPPING[source]
cowbird.utils.SUPPORTED_ACCEPT_TYPES[source]
cowbird.utils.SUPPORTED_FORMAT_TYPES[source]
cowbird.utils.KNOWN_CONTENT_TYPES[source]
cowbird.utils.CLI_MODE_CFG = cli_mode[source]
cowbird.utils.USE_TEST_CELERY_APP_CFG = use_test_celery_app[source]
cowbird.utils.get_logger(name: str, level: Optional[int] = None, force_stdout: bool = None, message_format: Optional[str] = None, datetime_format: Optional[str] = None)logging.Logger[source]

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is logging.NOTSET.

cowbird.utils.LOGGER[source]
cowbird.utils.set_logger_config(logger: logging.Logger, force_stdout: bool = False, message_format: Optional[str] = None, datetime_format: Optional[str] = None)logging.Logger[source]

Applies the provided logging configuration settings to the logger.

cowbird.utils.print_log(msg: str, logger: Optional[logging.Logger] = None, level: int = logging.INFO, **kwargs: Any)None[source]

Logs the requested message to the logger and optionally enforce printing to the console according to configuration value defined by COWBIRD_LOG_PRINT.

cowbird.utils.raise_log(msg: str, exception: Type[Exception] = Exception, logger: Optional[logging.Logger] = None, level: int = logging.ERROR)NoReturn[source]

Logs the provided message to the logger and raises the corresponding exception afterwards.

Raises

exception – whichever exception provided is raised systematically after logging.

cowbird.utils.bool2str(value: Any)str[source]

Converts value to explicit "true" or "false" str with permissive variants comparison that can represent common falsy or truthy values.

cowbird.utils.islambda(func: Any)bool[source]

Evaluate if argument is a callable lambda expression.

cowbird.utils.configure_celery(config, config_ini)[source]
cowbird.utils.get_app_config(container: cowbird.typedefs.AnySettingsContainer)pyramid.config.Configurator[source]

Generates application configuration with all required utilities and settings configured.

cowbird.utils.get_settings_from_config_ini(config_ini_path, section=None)[source]

Loads configuration INI settings with additional handling.

cowbird.utils.get_registry(container: cowbird.typedefs.AnyRegistryContainer, nothrow: bool = False)Optional[pyramid.registry.Registry][source]

Retrieves the application registry from various containers referencing to it.

cowbird.utils.get_json(response)[source]

Retrieves the ‘JSON’ body of a response using the property/callable according to the response’s implementation.

cowbird.utils.get_header(header_name: str, header_container: cowbird.typedefs.AnyHeadersType, default: Optional[str] = None, split: Optional[Union[str, List[str]]] = None)Optional[str][source]

Retrieves header_name by fuzzy match (independently of upper/lower-case and underscore/dash) from various framework implementations of Headers.

If split is specified, the matched header_name is first split with it and the first item is returned. This allows to parse complex headers (e.g.: text/plain; charset=UTF-8 to text/plain with split=';').

Parameters
  • header_name – header to find.

  • header_container – where to look for header_name.

  • default – value to returned if header_container is invalid or header_name could not be found.

  • split – character(s) to use to split the found header_name.

cowbird.utils.convert_response(response: cowbird.typedefs.AnyResponseType)pyramid.response.Response[source]

Converts a requests.Response object to an equivalent pyramid.response.Response object.

Content of the response is expected to be JSON.

Parameters

response – response to be converted

Returns

converted response

cowbird.utils.get_settings(container: Optional[cowbird.typedefs.AnySettingsContainer], app: bool = False)cowbird.typedefs.SettingsType[source]

Retrieve application settings from a supported container.

Parameters
  • container – supported container with an handle to application settings.

  • app – allow retrieving from current thread registry if no container was defined.

Returns

found application settings dictionary.

Raises

TypeError – when no application settings could be found or unsupported container.

cowbird.utils.fully_qualified_name(obj: Union[Any, Type[Any]])str[source]

Obtains the '<module>.<name>' full path definition of the object to allow finding and importing it.

cowbird.utils.log_request_format(request: pyramid.request.Request)str[source]
cowbird.utils.log_request(event: pyramid.events.NewRequest)None[source]

Subscriber event that logs basic details about the incoming requests.

cowbird.utils.log_exception_tween(handler, registry)[source]

Tween factory that logs any exception before re-raising it.

Application errors are marked as ERROR while non critical HTTP errors are marked as WARNING.

cowbird.utils.is_json_body(body: Any)bool[source]
class cowbird.utils.ExtendedEnum[source]

Bases: enum.Enum

Utility enum.Enum methods.

Create an extended enum with these utilities as follows:

class CustomEnum(ExtendedEnum):
    ItemA = "A"
    ItemB = "B"
classmethod names()List[str][source]

Returns the member names assigned to corresponding enum elements.

classmethod values()List[cowbird.typedefs.AnyKey][source]

Returns the literal values assigned to corresponding enum elements.

classmethod get(key_or_value: cowbird.typedefs.AnyKey, default: Optional[Any] = None)Optional[_TC][source]

Finds an enum entry by defined name or its value.

Returns the entry directly if it is already a valid enum.

class cowbird.utils.SingletonMeta[source]

Bases: type

A metaclass that creates a Singleton base class when called.

Create a class such that.

class A(object, metaclass=SingletonMeta):
    pass

class B(object, metaclass=SingletonMeta):
    pass

a1 = A()
a2 = A()
b1 = B()
b2 = B()
a1 is a2    # True
b1 is b2    # True
a1 is b1    # False
_instances[source]
__call__(*args, **kwargs)[source]

Call self as a function.

class cowbird.utils.NullType[source]

Bases: object

Represents a null value to differentiate from None.

__bool__[source]
__len__[source]
__repr__()[source]

Return repr(self).

static __nonzero__()[source]
cowbird.utils.null[source]
cowbird.utils.is_null(item)[source]
cowbird.utils.get_config_path(container: Optional[cowbird.typedefs.AnySettingsContainer] = None)str[source]
cowbird.utils.get_ssl_verify(container: Optional[cowbird.typedefs.AnySettingsContainer] = None)bool[source]
cowbird.utils.get_timeout(container: Optional[cowbird.typedefs.AnySettingsContainer] = None)int[source]
Package Contents
Classes

RemoveSlashNotFoundViewFactory

Utility that will try to resolve a path without appended slash if one was provided.

Functions

includeme(config)

cowbird.includeme(config)[source]
class cowbird.RemoveSlashNotFoundViewFactory(notfound_view=None)[source]

Bases: object

Utility that will try to resolve a path without appended slash if one was provided.

__call__(request)[source]
1

Created with sphinx-autoapi

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. All contributors are presented in AUTHORS file.

You can contribute in many ways:

Types of Contributions

Report Bugs

Report bugs as a new issue.

If you are reporting a bug, please include:

  • Your operating system name and version.

  • Any details about your local setup that might be helpful in troubleshooting.

  • Detailed steps to reproduce the bug.

Write Documentation

Cowbird could always use more documentation, whether as part of the official Cowbird docs, in docstrings, or even on the web in blog posts, articles, and such.

Submit Feedback

The best way to send feedback is to file a new issue.

If you are proposing a feature:

  • Explain in detail how it would work.

  • Keep the scope as narrow as possible, to make it easier to implement.

  • Remember that this is a volunteer-driven project, and that contributions are welcome :)

Provide utilities

If you made a convenient utility or tool that works conjointly with Cowbird in other to provide useful features or simply provide ease-of-life, don’t hesitate to open a PR referring to it in the documentation utilities. We love sharing and avoiding to rewrite stuff.

Get Started!

Ready to contribute? Here’s how to set up cowbird for local development.

  1. Clone the repository :

git clone https://github.com/Ouranosinc/cowbird
  1. Install your local copy (see installation)

  2. When you’re done making changes, check that your changes pass code formatting and tests:

make check
make test
  1. Commit your changes and push your branch to GitHub.

  2. Submit a pull request to the author (tests will run to evaluate that everything still works).

Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

  1. The pull request should include tests.

  2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in CHANGES (under relevant category of section Unreleased).

  3. The tests should work for the specified version of Python for this project.

Tips

To run a subset of tests:

make SPEC="<CUSTOM TEST SPECIFICATIONS>" test-custom

With <CUSTOM TEST SPECIFICATIONS> being any predefined markers, specific test classes or functions as supported by pytest runner.

Credits

Contributors

Changes

Unreleased (latest)

  • Nothing yet.

1.1.1 (2023-03-24)

Features / Changes
  • Return HTTP 424 (Failed Dependency) when the celery worker version cannot be retrieved on GET /version. Also, provide better error logs and detail messages in case of error to help debug the cause of the problem.

Bug Fixes
  • Fix incorrect typings and typographic errors.

1.1.0 (2023-03-14)

Features / Changes
  • Enforce specification of COWBIRD_CONFIG_PATH environment variable or cowbird.config_path INI configuration to provide the cowbird.yml file with definitions of services and permissions to manage, and raise directly at application startup otherwise. Without those definitions, Cowbird has no reason to exist.

  • Add logging details when handlers are processed, succeed and failed their operation to provide insights about Cowbird integration with other services.

  • Add COWBIRD_REQUEST_TIMEOUT environment variable and cowbird.request_timeout INI configuration parameters for specifying the connection timeout (default: 5s) to be applied when sending requests.

  • Add missing COWBIRD_SSL_VERIFY configuration setting in documentation.

  • Review FileSystem’s handler for user workspace creation/deletion and to ensure compatibility with birdhouse-deploy’s setup.

Bug Fixes
  • Add timeout to all request calls (pylint recommended fix to avoid infinite lock).

  • Minor typing fixes.

1.0.0 (2022-08-18)

Features / Changes
  • Renamed Cowbird services term to handlers, to avoid confusion with Magpie services.

Bug Fixes

n/a

0.5.0 (2022-08-15)

Features / Changes
  • Add synchronization of Magpie permissions between different Magpie services, when receiving incoming webhooks.

  • Update config’s services sections under sync_permissions to use actual Magpie service names instead of Cowbird handler names (relates to #22).

  • Reorganize config.example.yml to support more sync cases, provide info on the type of each segment of a resource path and to use tokenized path.

  • Add schema validation when starting cowbird app.

Bug Fixes

n/a

0.4.1 (2022-03-09)

Features / Changes
  • Add an SSL verification setting.

  • Add Geoserver workspace and datastore creation/removal linked to user creation/removal.

  • Add automated publishing of shapefiles to Geoserver when new files are found.

  • Use pip legacy and faster resolver as per pypa/pip#9187 (comment) since current one is endlessly failing to resolve development packages (linting tools from check targets).

Bug Fixes
  • Pin pymongo<4 to work with pinned celery version.

0.4.0 (2021-08-05)

Features / Changes
  • Basic users’ workspaces management for new or removed users.

  • Add a Mongo database backend to store/restore monitoring state across sessions.

Bug Fixes
  • Celery has now a proper result backend.

  • Celery tasks are auto-discovered package-wide, no need to import them manually.

0.3.0 (2021-07-06)

Features / Changes
  • Add the RequestTask celery task for handling external services requests.

  • Add a docker image for the celery worker

Bug Fixes

n/a

0.2.0 (2021-05-12)

Features / Changes
  • Preliminary design which includes:

    • Webhook API

    • Services interface

    • Permissions synchronizer

    • File system monitoring

Bug Fixes

n/a

0.1.0 (2021-02-18)

Features / Changes
  • First structured release which includes:

    • CI/CD utilities

    • Minimal testing of utils

    • Documentation of generic details (WebApp, CLI, OpenAPI, configs, etc.)

    • Metadata of the package

    • Minimal /services API route with dummy Service

    • Corresponding cowbird services list CLI command

Bug Fixes

n/a

Glossary

Handler

Managed component for which Cowbird provides some sort of interactive Operation.

Operation

Sequence of execution steps that configures or sends requests to other components of the bird-house stack in order to produce an end result where those components, that normally don’t interact directly together, will be able to obtain a combined and enhanced feature.

Indices and Tables