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:2.2.0

pavics/cowbird:2.2.0-worker

pavics/cowbird:2.2.0-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. See also the Handlers section for more details on individual handlers.

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}
    wps_outputs_dir: ${WPS_OUTPUTS_DIR}
    secure_data_proxy_name: ${SECURE_DATA_PROXY_NAME}
    public_workspace_wps_outputs_subpath: ${PUBLIC_WORKSPACE_WPS_OUTPUTS_SUBPATH}
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 type. The service types found in this section of the config should also exist in Magpie.

See also

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

Each service type 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

Components Diagram

Cowbird Components

Handlers

Each handler is associated to a service and is used to process different events and to keep the different services of the platform synchronized. Handlers are useful for example to process user or permission changes, or to manage file modification events.

FileSystem

The FileSystem handler is used to manage some aspects of the directory/file structure associated with the platform. It is specifically used to handle user workspaces and the user access to different other directories. The handler is responsible for creating/deleting a workspace if a user is created/deleted.

Here are some typical directories found in the user_workspaces:

/user_workspaces/<user_name>/notebooks -> /jupyterhub_user_data/<user_name>
/user_workspaces/<user_name>/shapefile_datastore  # Managed by the `GeoServer` handler
/user_workspaces/public/wps_outputs  # Managed by the `FileSystem` handler
JupyterHub user data

A symlink is created in the user workspace to give access to the notebook directory of the user. The notebook directory is the directory that was originally mounted in bird-house as the writable-workspace. When adding the Cowbird component to bird-house (see here), the mounted writable-workspace becomes the user workspace managed by Cowbird (e.g.: /user_workspaces/<user_name>) which requires a symlink to access the notebook directory originally used by bird-house and JupyterHub.

WPS outputs data

The WPS outputs data, generated by the different WPS birds and Weaver, is stored in a distinct data directory and must be made accessible to the users via their workspace.

There are 2 types of data :

  • Public data: This data must be accessible to every user.

  • User specific data: This data must only be accessible to the related user.

The public WPS outputs data is made accessible by generating hardlinks from the WPS outputs data directory to the user workspaces location (e.g.:/user_workspaces/public/wps_outputs). When a JupyterLab instance is started via bird-house, the directory containing the hardlinks will be mounted as a volume, such that the users obtain access to its content via their JupyterLab instance. The volume will be made read-only to prevent a user from modifying the public data.

The user WPS outputs data is made accessible by generating hardlinks from a WPS outputs data directory containing user data to a subdirectory found in the related user’s workspace. For example, with a source path /wps_outputs/<bird-name>/users/<user-id>/<job-id>/<output-file>, a hardlink is generated at the path /user_workspaces/<user-name>/wps_outputs/<bird-name>/<job-id>/<output-file>. The hardlink path uses a similar structure as found in the source path, but removes the redundant users and <user-id> path segments. The hardlink files will be automatically available to the user on a JupyterLab instance since the workspace is mounted as a volume. Any file that is found under a directory /wps_outputs/<bird-name>/users/<user-id>/ is considered to be user data and any outside file is considered public.

The permissions found on the user data are synchronized with the permissions found on Magpie. If Magpie uses a secure-data-proxy service, this service handles the permissions of those files (see here). If a file does not have a corresponding route on the secure-data-proxy service, it will use the closest parent permissions.

Note

If the access to a WPS outputs file is allowed, the file access will be read-only and any write permissions from the secure-data-proxy service will be ignored. This is because WPS outputs are produced by external processes and the resulting data should remain constant.

Note

The files/directories permissions are only applied to others (see Components - Usage of ‘others’ permissions section for details).

Warning

The route resources found under the secure-data-proxy service must match exactly a path on the filesystem, starting with the directory name wps_outputs, and following with the desired children directories/file names.

If the file does not have any read or write permissions, the hardlink will not be available in the user’s workspace.

Note

Permissions should not be modified via the file system, but should only be managed via the secure-data-proxy service on Magpie. Permission modifications on the file system will be ignored.

Refer to DAC-571 for more details on the design choices for the management of permissions.

If no secure-data-proxy service is found, all user files are assumed to be available with read permissions for the user.

Note that different design choices were made to respect the constraints of the file system and to prevent the user from accessing forbidden data:

  • To avoid having to copy every file from the WPS outputs data directory to the corresponding user workpaces, the usage of links was chosen.

  • The usage of hardlinks was chosen instead of symlinks. The reason is that using symlinks would require mounting the WPS outputs data directory on the user JupyterLab instance. This is because symlinks require access to their source files, contrary to hardlinks which can be mounted individually without access to source files. Mounting the whole WPS outputs data directory would give the user access to all the data. Even if the data is not made available on the JupyterLab browser via the UI, the data would still be accessible via the terminal found on JupyterLab. Using hardlinks lets us mount only the public directory instead of the whole WPS outputs directory, which contains a mix of public and user data.

  • Changing permissions of the linked workspace files to control user access was not an option since symlinks and hardlinks always use the same permissions as their original source file. Symlinks/hardlinks cannot have custom file permissions independent from their source file. Therefore, it is not possible for example to give access to a user and prevent the access to another user for a specific file using the file permissions, even if users have their own hardlinks or symlinks in their personal workspace.

  • Another considered option was to add anonymous volumes to hide some parts of the WPS outputs data directory. This could have been useful to mount the whole WPS outputs directory on the user JupyterLab instance and to hide the user data subdirectories found in the WPS outputs by using anonymous volumes for each user subdirectory. This would automatically mount the public data while hiding the user related data. It was still considered easier and safer to go with the hardlinks option to prevent potential errors which could accidentally give access to other users’ data. For example, if a bird directory was created while a user JupyterLab instance was running, it would require both the instance and JupyterHub to be restarted in order to generate the new required anonymous volume to hide the user data from that new bird. Without a restart of the instance, the user could potentially have access to some of the new user data found in the new bird directory.

In conclusion, the best option was to use hardlinks, which do not require access to the original source file, to create separate user and public data access points, and volume mounting to control which locations are made available to the user.

See also

Refer to DAC-149 for details on the design choices for managing the access to WPS outputs data.

Geoserver

The GeoServer handler is used to keep the internal representation on the GeoServer server along with the user workspace in sync with the rest of the platform.

If a new user is created on Magpie, a GeoServer workspace is automatically created for the user, along with a datastore directory in the user workspace to contain the different shapefiles of the user. Similarly, if the user is deleted on Magpie, the GeoServer workspace of the user is automatically deleted to keep the services synchronized.

The workspace and file permissions are also synchronized between Magpie and GeoServer. For example, if a permission is added or removed in Magpie, the file found in the user’s datastore must have corresponding permissions in order to reflect the actual user access permissions.

Since the Magpie permissions on a resource from a service of type GeoServer are not the same as traditional Unix permissions (e.g.: rwx) on the workspace/shapefiles, some design choices were done in order to have a coherent synchronization :

Permission/Category definition

All permissions on Magpie on a resource from a service of type GeoServer are classified as either readable or writable in order to associate them to the actual path permissions. If the path receives a read permission, all Magpie permissions fitting the readable category will be enabled.

If a Magpie permission from the readable category is added, the path will be updated to have read permissions. This update on the file system will trigger a synchronization with Magpie, to add all other readable permissions on Magpie. For example, if the GetFeature permission is added to a Layer resource on Magpie, the associated shapefile will receive read permissions because GetFeature is a permission from the readable category. Since the file permissions are modified, it will trigger another event to synchronize permissions with Magpie, enabling, on the Layer resource, all other readable permissions : DescribeFeatureType, DescribeStoredQueries, GetCapabilities, etc. The same process would apply if we use permissions from the writable category in this last example.

Permission creation conditions

Note that permissions are only added to Magpie if necessary. For example, if a file needs to allow a readable permission on Magpie, but that permission already resolves to allow because of a recursive permission on a parent resource, no permission will be added. The permission is already resolving to the required permission and avoiding to add unnecessary permissions will simplify permission solving.

Also, in the case where a user has all the readable permissions enabled on Magpie, for example, and a single one of them is deleted, Cowbird will not change the file permissions since other permissions from the readable category will still be found on Magpie. This means that a synchronization will not be triggered and Magpie permissions will stay the same, meaning all the readable permissions activated except for the one removed. If eventually a change is applied to the file (e.g.: changing the permissions from r-- to rw-), it would trigger a synchronization, and the one Magpie permission that was removed earlier would be re-enabled, because of the read permission found on the file. Consequently, it is not recommended to have a partial usage of readable permissions on Magpie since there is a risk that the disabled readable permissions will be eventually automatically enabled if an update on the file is done. If we want to disable the read permissions via Magpie, it is better to disable the permissions from the readable category all at once, which will trigger a change to remove the read permission on the associated path and which will prevent having eventual undesired re-enabled Magpie permissions. The same would apply if we use write permissions in this last example.

The files/directories permissions are only applied to others (see Components - Usage of ‘others’ permissions section for details). If a permission is applied to a group in Magpie, the GeoServer handler will detect the permission change but will not do anything since Magpie groups are different than the groups found on the file system. Also, it would not make sense to update the path associated to a resource for all the users of a group, since the path is supposed to be associated to a single user anyway.

Note that even if group permission changes on Magpie are not handled by Cowbird, a group permission could still have an impact on permission resolution. For example, if a shapefile needs to allow a readable permission on Magpie, but that permission already resolves to allow because of a group permission, no permission will be added.

File/Layer permissions

File events will only be processed in the case of the .shp file, since it is considered to be the main component of a shapefile. The other extensions associated with a shapefile will not be processed if they trigger an event, and will only be updated in the case of a change on the .shp file.

Shapefiles will only be assigned read or write permissions on the file system. execute permissions are not needed for shapefiles.

Directory/Workspace permissions

Workspaces will always keep their execute permissions even if they don’t have any permissions enabled on Magpie. This enables accessing the children files, in case the children resource has permissions enabled on Magpie. Since a children resource has priority on Magpie if its permissions are enabled, it makes sense to allow the access to the file on the file system too. Note that if the directory only has execute permissions, the file will only be accessible via a direct path or url, and it will not be accessible via a file browser, or on the JupyterLab file browser. This should allow the user to still share his file using a path or url. To allow browsing the directory’s content, the read permission is also required on the directory, which can be obtained by enabling permissions of the readable category on the corresponding workspace on Magpie.

Operations to avoid

Note that some operations should be avoided, as they are undesirable and not supported for now.

  • Using subdirectories in the shapefile datastore :

    Using subdirectories in the shapefile datastore directory is not supported for now. Only the shapefiles found directly under the datastore directory will be processed by the GeoServer handler and subdirectories will be ignored. This also corresponds to the design in Magpie where a Workspace resource can only have children resources of the type Layer, and cannot have a Workspace type resource as a children.

  • Renaming a directory :

    The directories associated with the GeoServer workspace are the user workspace (named by the user’s name) and the datastore directory (which uses a default value). Both of these values should never change and renaming them manually might break the monitoring, preventing Cowbird from receiving future file events.

  • Renaming a shapefile (.shp only) :

    This operation is actually supported, but it should be avoided if possible. It will trigger multiple events on the file system (an update on the parent directory, and a delete followed by a create event on the file), which should keep up to data info in GeoServer and Magpie by simply generating new resources. A risk with this is that the delete event will delete the other shapefile files, and the user could lose some data. It is better to have a copy of the shapefile before applying this operation. Note that renaming one of the other extension (not the .shp file) will not trigger any event since only the main file triggers events.

  • Deleting a directory :

    This operation will only display a warning in Cowbird’s logs. It should never be done manually, since it will create inconsistencies with the GeoServer workspace and the Magpie resources. The user workspace and the datastore directory should only be deleted when a user is deleted via Magpie.

Usage of others permissions

With the GeoServer and the FileSystem handlers, the permissions applied on the files/directories are only applied to others, and the permissions on the user and on the group are not modified. The user and group associated with the paths will be the admin user/group (root by default), while the user who will interact with the paths, for example in JupyterHub, is a distinct user, hence why the permissions are applied to others. This will also prevent the user from changing the permissions if he decides to interact with the terminal accessible via JupyterLab.

Note that, consequently, the concept of a Magpie group is not used on the file system for now, since the group on the file system does not correspond to the groups found on Magpie.

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(→ cowbird.typedefs.AnyResponseType)

List all registered handlers.

get_handler(→ cowbird.handlers.handler.Handler)

Get a handler object from the parameters of a request.

get_handler_view(→ cowbird.typedefs.AnyResponseType)

Get handler details.

resync_handler_view(→ cowbird.typedefs.AnyResponseType)

Resync handler operation.

cowbird.api.handlers.views.get_handlers_view(request: pyramid.request.Request) cowbird.typedefs.AnyResponseType[source]

List all registered handlers.

cowbird.api.handlers.views.get_handler(request: pyramid.request.Request) cowbird.handlers.handler.Handler[source]

Get a handler object from the parameters of a request.

cowbird.api.handlers.views.get_handler_view(request: pyramid.request.Request) cowbird.typedefs.AnyResponseType[source]

Get handler details.

cowbird.api.handlers.views.resync_handler_view(request: pyramid.request.Request) cowbird.typedefs.AnyResponseType[source]

Resync handler operation.

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(→ None)

cowbird.api.handlers.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = 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: pyramid.config.Configurator) None[source]
cowbird.api.home
Submodules
cowbird.api.home.views
Module Contents
Functions

get_homepage(→ cowbird.typedefs.AnyResponseType)

Cowbird API homepage.

get_version(→ cowbird.typedefs.AnyResponseType)

Version of the API.

get_worker_version(→ str)

Attributes

LOGGER

cowbird.api.home.views.LOGGER[source]
cowbird.api.home.views.get_homepage(request: pyramid.request.Request) cowbird.typedefs.AnyResponseType[source]

Cowbird API homepage.

cowbird.api.home.views.get_version(request: pyramid.request.Request) cowbird.typedefs.AnyResponseType[source]

Version of the API.

cowbird.api.home.views.get_worker_version() str[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(→ None)

Attributes

LOGGER

cowbird.api.home.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = 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: pyramid.config.Configurator) None[source]
cowbird.api.swagger
Submodules
cowbird.api.swagger.views
Module Contents
Functions

api_swagger(→ cowbird.typedefs.JSON)

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: pyramid.request.Request) cowbird.typedefs.JSON[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(→ cowbird.typedefs.JSON)

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(→ None)

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: pyramid.request.Request) cowbird.typedefs.JSON[source]

Swagger UI route to display the Cowbird REST API schemas.

cowbird.api.swagger.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = 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: pyramid.config.Configurator) None[source]
cowbird.api.webhooks
Submodules
cowbird.api.webhooks.views
Module Contents
Functions

dispatch(→ None)

post_user_webhook_view(→ cowbird.typedefs.AnyResponseType)

User webhook used for created or removed user events.

post_permission_webhook_view(...)

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: Callable[[cowbird.handlers.Handler], None]) None[source]
cowbird.api.webhooks.views.post_user_webhook_view(request: pyramid.request.Request) cowbird.typedefs.AnyResponseType[source]

User webhook used for created or removed user events.

cowbird.api.webhooks.views.post_permission_webhook_view(request: pyramid.request.Request) cowbird.typedefs.AnyResponseType[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(→ None)

cowbird.api.webhooks.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = 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: pyramid.config.Configurator) None[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(…)

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(→ str)

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: Any, param_compare: Any | List[Any] | Type[Any] | List[Type[Any]] | None = None, param_name: str | None = None, param_content: cowbird.typedefs.JSON | None = None, with_param: bool = True, http_error: Type[pyramid.httpexceptions.HTTPError] = HTTPBadRequest, http_kwargs: cowbird.typedefs.ParamsType | None = None, msg_on_fail: str = '', content: cowbird.typedefs.JSON | None = 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: cowbird.typedefs.JSON, param: Any, param_compare: Any, param_name: str, with_param: bool, param_content: cowbird.typedefs.JSON | None, 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: Callable[[], Any], fallback: Callable[[], None] | None = None, http_error: Type[pyramid.httpexceptions.HTTPError] = HTTPInternalServerError, http_kwargs: cowbird.typedefs.ParamsType | None = None, msg_on_fail: str = '', content: cowbird.typedefs.JSON | None = 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: Type[pyramid.httpexceptions.HTTPSuccessful] | Type[pyramid.httpexceptions.HTTPRedirection] = HTTPOk, http_kwargs: cowbird.typedefs.ParamsType | None = None, detail: str | None = '', content: cowbird.typedefs.JSON | None = None, content_type: str | None = CONTENT_TYPE_JSON) 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: Type[pyramid.httpexceptions.HTTPError] = HTTPInternalServerError, http_kwargs: cowbird.typedefs.ParamsType | None = None, detail: str = '', content: cowbird.typedefs.JSON | None = None, content_type: str = CONTENT_TYPE_JSON, nothrow: Literal[False] = False) NoReturn[source]
cowbird.api.exception.raise_http(http_error: Type[pyramid.httpexceptions.HTTPError] = HTTPInternalServerError, http_kwargs: cowbird.typedefs.ParamsType | None = None, detail: str = '', content: cowbird.typedefs.JSON | None = None, content_type: str = CONTENT_TYPE_JSON, nothrow: Literal[True] = False) pyramid.httpexceptions.HTTPException

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: Type[pyramid.httpexceptions.HTTPException], http_base: Type[pyramid.httpexceptions.HTTPException] | Iterable[Type[pyramid.httpexceptions.HTTPException]], detail: str, content: cowbird.typedefs.JSON | None, 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: int, detail: str, content: cowbird.typedefs.JSON, content_type: str) str[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: str | cowbird.typedefs.JSON, content_type: str) Tuple[str, cowbird.typedefs.JSON | None][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: cowbird.typedefs.ParamsType | None, content: cowbird.typedefs.JSON, content_type: str | None = CONTENT_TYPE_PLAIN, metadata: cowbird.typedefs.JSON | None = 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
Classes

RemoveSlashNotFoundViewFactory

Utility that will try to resolve a path without appended slash if one was provided.

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 supported by the

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]
class cowbird.api.generic.RemoveSlashNotFoundViewFactory(notfound_view: Callable[[pyramid.request.Request], cowbird.typedefs.AnyResponseType] | None = None)[source]

Bases: object

Utility that will try to resolve a path without appended slash if one was provided.

__call__(request: pyramid.request.Request) cowbird.typedefs.AnyResponseType[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 supported 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: pyramid.httpexceptions.HTTPException | pyramid.request.Request | pyramid.response.Response, content: cowbird.typedefs.JSON | None = 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: pyramid.request.Request | pyramid.httpexceptions.HTTPException, default_message: str | None = 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(→ Dict[str, Any])

get_multiformat_body_raw(→ Any)

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

get_multiformat_body(…)

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: Type[Any] | Tuple[Type[Any], Ellipsis] = str, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = 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: pyramid.request.Request) Dict[str, Any][source]
cowbird.api.requests.get_multiformat_body_raw(request: pyramid.request.Request, key: str, default: Any | None = 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: Type[str] = str, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) str[source]
cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[str | None] = (str, type(None)), pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) str | None
cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[int] = int, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) int
cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[float] = float, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) float
cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[bool] = bool, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) bool
cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[List[Any]] = list, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) cowbird.typedefs.JSON
cowbird.api.requests.get_multiformat_body(request: pyramid.request.Request, key: str, default: Any = None, check_type: Type[Dict[str, Any]] = dict, pattern: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = None) cowbird.typedefs.JSON

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: str | bool | None = ax.PARAM_REGEX, http_error: Type[pyramid.httpexceptions.HTTPError] | None = None, msg_on_fail: str | None = 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: str | Iterable[str], default: Any | None = 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_Check_NotFoundResponseSchema

Fundamental building block of schemas.

HandlerResync_PUT_RequestSchema

Fundamental building block of schemas.

HandlerResync_PUT_OkResponseSchema

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(→ cowbird.typedefs.JSON)

service_api_route_info(→ Dict[str, Any])

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

HandlerResyncAPI

UserWebhookAPI

PermissionWebhookAPI

OperationParameter

HandlerNameParameter

APITag

WebhooksTag

HandlersTag

TAG_DESCRIPTIONS

Handlers_GET_responses

Handlers_POST_responses

Handler_GET_responses

Handler_PATCH_responses

HandlerResync_PUT_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: cowbird.typedefs.JSON[source]
cowbird.api.schemas.SecurityCookieAuthAPI: cowbird.typedefs.JSON[source]
cowbird.api.schemas.SecurityDefinitionsAPI: cowbird.typedefs.JSON[source]
cowbird.api.schemas.SecurityAuthenticatedAPI: cowbird.typedefs.JSON[source]
cowbird.api.schemas.SecurityAdministratorAPI: cowbird.typedefs.JSON[source]
cowbird.api.schemas.SecurityEveryoneAPI: cowbird.typedefs.JSON[source]
cowbird.api.schemas.get_security(service: cornice.Service, method: cowbird.typedefs.HTTPMethod) cowbird.typedefs.JSON[source]
cowbird.api.schemas.service_api_route_info(service_api: cornice.Service, **kwargs: Any) Dict[str, Any][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: cowbird.typedefs.JSON) 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.HandlerResyncAPI[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: int, description: str, **kw: Any)[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: int, description: str, **kw: Any)[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: Any)[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: Any)[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: int, description: str, **kw: Any)[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: int, description: str, **kw: Any)[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: int, description: str, **kw: Any)[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_Check_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.HandlerResync_PUT_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.HandlerResync_PUT_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 = 'Handler resync successful.'[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: int, description: str, **kw: Any)[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: int, description: str, **kw: Any)[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.HandlerResync_PUT_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(→ None)

Include API sub-modules.

cowbird.api.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = 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: pyramid.config.Configurator) None[source]

Include API sub-modules.

Each should define 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(→ SubParserArgs)

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(→ None)

Attributes

CommandPrefixes

SharedParsers

ParsedArgs

ParserArgs

HelperParser

ParseResult

ParserMaker

ParserRunner

SubParserArgs

PrintFormat

cowbird.cli.utils.CommandPrefixes[source]
cowbird.cli.utils.SharedParsers[source]
cowbird.cli.utils.ParsedArgs[source]
cowbird.cli.utils.ParserArgs[source]
cowbird.cli.utils.HelperParser[source]
cowbird.cli.utils.ParseResult[source]
cowbird.cli.utils.ParserMaker[source]
cowbird.cli.utils.ParserRunner[source]
cowbird.cli.utils.SubParserArgs[source]
cowbird.cli.utils.PrintFormat[source]
cowbird.cli.utils.subparser_help(description: str, parent_parser: argparse.ArgumentParser | None = None) SubParserArgs[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: logging.Logger | None = None) None[source]
cowbird.cli.utils.get_format_parser() argparse.ArgumentParser[source]
cowbird.cli.utils.print_format(data: cowbird.typedefs.JSON, fmt: PrintFormat, section: str | None = None) None[source]
Package Contents
Functions

get_logger_parser(→ argparse.ArgumentParser)

subparser_help(→ SubParserArgs)

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(→ Optional[int])

Automatically groups all sub-helper CLI listed in cowbird.cli as a common cowbird CLI entrypoint.

Attributes

ParserMaker

ParserRunner

LOGGER

cowbird.cli.ParserMaker[source]
cowbird.cli.ParserRunner[source]
cowbird.cli.get_logger_parser() argparse.ArgumentParser[source]
cowbird.cli.subparser_help(description: str, parent_parser: argparse.ArgumentParser | None = None) SubParserArgs[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: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = 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: Sequence[str] | None = None) int | 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: cowbird.typedefs.StoreSelector, *store_args: Any, **store_kwargs: Any) cowbird.database.stores.StoreInterface[source]
abstract reset_store(store_type: cowbird.typedefs.StoreSelector) cowbird.database.stores.StoreInterface[source]
abstract get_session() Any[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

AnyMongodbStoreType

cowbird.database.mongodb.MongoDB: pymongo.database.Database | None[source]
cowbird.database.mongodb.MongodbStores[source]
cowbird.database.mongodb.AnyMongodbStore[source]
cowbird.database.mongodb.AnyMongodbStoreType[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: pymongo.database.Database[source]
_settings: cowbird.typedefs.SettingsType[source]
_stores: Dict[str, AnyMongodbStore][source]
type = 'mongodb'[source]
reset_store(store_type: AnyMongodbStoreType) AnyMongodbStore | None[source]
get_store(store_type: 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: str[source]
index_fields: List[str] = [][source]
class cowbird.database.stores.MongodbStore(collection: pymongo.collection.Collection, *_: Any, **__: Any)[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[Any, Ellipsis], Dict[str, Any]][source]

Filters MongodbStore-specific arguments to safely pass them down its __init__.

class cowbird.database.stores.MonitoringStore(*args: Any, **kwargs: Any)[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(drop: bool = True) 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(→ None)

Attributes

AnySettingsContainer

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: pymongo.database.Database
_settings: cowbird.typedefs.SettingsType
_stores: Dict[str, AnyMongodbStore]
type = 'mongodb'
reset_store(store_type: AnyMongodbStoreType) AnyMongodbStore | None[source]
get_store(store_type: 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.AnySettingsContainer[source]
cowbird.database.get_registry(container: cowbird.typedefs.AnyRegistryContainer, nothrow: bool = False) pyramid.registry.Registry | None[source]

Retrieves the application registry from various containers referencing to it.

cowbird.database.get_settings(container: cowbird.typedefs.AnySettingsContainer | None, app: bool = False) cowbird.typedefs.SettingsType[source]

Retrieve application settings from a supported container.

Parameters:
  • container – supported container with a 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: pyramid.config.Configurator) None[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: List[cowbird.handlers.handler.AnyHandlerParameter][source]
user_created(user_name: str) None[source]
user_deleted(user_name: str) None[source]
abstract permission_created(permission: cowbird.permissions_synchronizer.Permission) None[source]
abstract permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None[source]
static get_instance() Catalog | None[source]

Return the Catalog singleton instance from the class name used to retrieve the FSMonitor from the DB.

on_created(path: str) None[source]

Called when a new path is found.

Parameters:

path – Absolute path of a new file/directory

on_deleted(path: str) None[source]

Called when a path is deleted.

Parameters:

path – Absolute path of a new file/directory

on_modified(path: str) None[source]

Called when a path is updated.

Parameters:

path – Absolute path of a new file/directory

abstract resync() None[source]
cowbird.handlers.impl.filesystem
Module Contents
Classes

FileSystem

Keep the proper directory structure in sync with the platform.

Attributes

LOGGER

DEFAULT_NOTEBOOKS_DIR_NAME

DEFAULT_PUBLIC_WORKSPACE_WPS_OUTPUTS_SUBPATH

DEFAULT_WPS_OUTPUTS_RES_NAME

DEFAULT_SECURE_DATA_PROXY_NAME

DEFAULT_USER_WPS_OUTPUTS_DIR_NAME

cowbird.handlers.impl.filesystem.LOGGER[source]
cowbird.handlers.impl.filesystem.DEFAULT_NOTEBOOKS_DIR_NAME = 'notebooks'[source]
cowbird.handlers.impl.filesystem.DEFAULT_PUBLIC_WORKSPACE_WPS_OUTPUTS_SUBPATH = 'public/wps_outputs'[source]
cowbird.handlers.impl.filesystem.DEFAULT_WPS_OUTPUTS_RES_NAME = 'wps_outputs'[source]
cowbird.handlers.impl.filesystem.DEFAULT_SECURE_DATA_PROXY_NAME = 'secure-data-proxy'[source]
cowbird.handlers.impl.filesystem.DEFAULT_USER_WPS_OUTPUTS_DIR_NAME = 'wps_outputs'[source]
class cowbird.handlers.impl.filesystem.FileSystem(settings: cowbird.typedefs.SettingsType, name: str, jupyterhub_user_data_dir: str, wps_outputs_dir: str, secure_data_proxy_name: str = DEFAULT_SECURE_DATA_PROXY_NAME, wps_outputs_res_name: str = DEFAULT_WPS_OUTPUTS_RES_NAME, notebooks_dir_name: str = DEFAULT_NOTEBOOKS_DIR_NAME, public_workspace_wps_outputs_subpath: str = DEFAULT_PUBLIC_WORKSPACE_WPS_OUTPUTS_SUBPATH, user_wps_outputs_dir_name: str = DEFAULT_USER_WPS_OUTPUTS_DIR_NAME, **kwargs: Any)[source]

Bases: cowbird.handlers.handler.Handler, cowbird.monitoring.fsmonitor.FSMonitor

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

  • wps_outputs_dir – Path to the wps outputs directory

  • secure_data_proxy_name – Name of the secure-data-proxy service found on Magpie

  • wps_outputs_res_name – Name of the WPS outputs resource found on Magpie under the secure-data-proxy service

  • notebooks_dir_name – Name of the symlink directory found in the user workspace and which directs to the user’s notebook directory

  • public_workspace_wps_outputs_subpath – Subpath to the directory containing hardlinks to the public WPS outputs data

  • user_wps_outputs_dir_name – Name of the directory found in the user workspace and which contains the hardlinks to the user WPS outputs data

required_params[source]
start_wps_outputs_monitoring(monitoring: cowbird.monitoring.monitoring.Monitoring) None[source]
get_user_workspace_dir(user_name: str) str[source]
get_user_workspace_wps_outputs_dir(user_name: str) str[source]
get_public_workspace_wps_outputs_dir() str[source]
_get_jupyterhub_user_data_dir(user_name: str) str[source]
user_created(user_name: str) None[source]
user_deleted(user_name: str) None[source]
static get_instance() FileSystem[source]

Return the FileSystem singleton instance from the class name used to retrieve the FSMonitor from the DB.

_get_secure_data_proxy_file_perms(src_path: str, user_name: str) Tuple[bool, bool][source]

Finds a route from the secure-data-proxy service that matches the resource path (or one of its parent resource) and gets the user permissions on that route.

update_secure_data_proxy_path_perms(src_path: str, user_name: str) bool[source]

Gets a path’s permissions from the secure-data-proxy service and updates the file system permissions accordingly.

Returns a boolean to indicate if the user should have some type of access to the path or not.

Creates a hardlink path from a source file, if the user has access rights.

on_created(path: str) None[source]

Call when a new path is found.

Parameters:

path – Absolute path of a new file/directory

on_modified(path: str) None[source]

Called when a path is updated.

Parameters:

path – Absolute path of a new file/directory

Deletes the hardlink path that corresponds to the input source path.

Returns a bool to indicate if a hardlink path was deleted or not.

on_deleted(path: str) None[source]

Called when a path is deleted.

Parameters:

path – Absolute path of a new file/directory

_check_if_res_from_secure_data_proxy(res_tree: List[cowbird.typedefs.JSON]) bool[source]

Checks if the resource is part of a secure-data-proxy service of type API.

_update_permissions_on_filesystem(permission: cowbird.permissions_synchronizer.Permission) None[source]
permission_created(permission: cowbird.permissions_synchronizer.Permission) None[source]
permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None[source]
resync() None[source]

Resync operation, regenerating required links (user_workspace, wps_outputs, …)

cowbird.handlers.impl.geoserver
Module Contents
Classes

GeoserverFuncSupportsWorkspace

Base class for protocol classes.

GeoserverFuncSupportsDatastore

Base class for protocol classes.

GeoserverFuncSupportsShapefile

Base class for protocol classes.

Geoserver

Keep Geoserver internal representation in sync with the platform.

Functions

geoserver_response_handling(…)

Decorator for response and logging handling for the different Geoserver HTTP requests.

create_workspace(→ None)

create_datastore(→ None)

remove_workspace(→ None)

validate_shapefile(→ None)

publish_shapefile(→ None)

remove_shapefile(→ None)

Attributes

GeoserverType

GeoserverFunc

SHAPEFILE_MAIN_EXTENSION

SHAPEFILE_REQUIRED_EXTENSIONS

SHAPEFILE_OPTIONAL_EXTENSIONS

SHAPEFILE_ALL_EXTENSIONS

DEFAULT_DATASTORE_DIR_NAME

LOGGER

cowbird.handlers.impl.geoserver.GeoserverType: typing_extensions.TypeAlias = 'Geoserver'[source]
class cowbird.handlers.impl.geoserver.GeoserverFuncSupportsWorkspace[source]

Bases: Protocol

Base class for protocol classes.

Protocol classes are defined as:

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:

class GenProto(Protocol[T]):
    def meth(self) -> T:
        ...
__call__(*, workspace_name: str) requests.Response[source]
class cowbird.handlers.impl.geoserver.GeoserverFuncSupportsDatastore[source]

Bases: Protocol

Base class for protocol classes.

Protocol classes are defined as:

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:

class GenProto(Protocol[T]):
    def meth(self) -> T:
        ...
__call__(*, workspace_name: str, datastore_name: str, datastore_path: str) requests.Response[source]
class cowbird.handlers.impl.geoserver.GeoserverFuncSupportsShapefile[source]

Bases: Protocol

Base class for protocol classes.

Protocol classes are defined as:

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:

class GenProto(Protocol[T]):
    def meth(self) -> T:
        ...
__call__(*, workspace_name: str, datastore_name: str, filename: str) requests.Response[source]
cowbird.handlers.impl.geoserver.GeoserverFunc[source]
cowbird.handlers.impl.geoserver.SHAPEFILE_MAIN_EXTENSION = '.shp'[source]
cowbird.handlers.impl.geoserver.SHAPEFILE_REQUIRED_EXTENSIONS[source]
cowbird.handlers.impl.geoserver.SHAPEFILE_OPTIONAL_EXTENSIONS = ['.atx', '.sbx', '.qix', '.aih', '.ain', '.shp.xml', '.cpg'][source]
cowbird.handlers.impl.geoserver.SHAPEFILE_ALL_EXTENSIONS[source]
cowbird.handlers.impl.geoserver.DEFAULT_DATASTORE_DIR_NAME = 'shapefile_datastore'[source]
cowbird.handlers.impl.geoserver.LOGGER[source]
cowbird.handlers.impl.geoserver.geoserver_response_handling(func: GeoserverFuncSupportsWorkspace) GeoserverFuncSupportsWorkspace[source]
cowbird.handlers.impl.geoserver.geoserver_response_handling(func: GeoserverFuncSupportsDatastore) GeoserverFuncSupportsDatastore
cowbird.handlers.impl.geoserver.geoserver_response_handling(func: GeoserverFuncSupportsShapefile) GeoserverFuncSupportsShapefile

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, admin_user: str | None = None, admin_password: str | None = None, **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

  • admin_user – Geoserver admin username

  • admin_password – Geoserver admin password

required_params[source]
user_created(user_name: str) None[source]
user_deleted(user_name: str) None[source]
get_shapefile_list(workspace_name: str, shapefile_name: str) List[str][source]

Generates the list of all files associated with a shapefile name.

_update_resource_paths_permissions(resource_type: str, permission: cowbird.permissions_synchronizer.Permission, resource_id: int, workspace_name: str, layer_name: str | None = None) None[source]

Updates a single Magpie resource’s associated paths according to its permissions found on Magpie.

_update_resource_paths_permissions_recursive(resource: cowbird.typedefs.JSON, permission: cowbird.permissions_synchronizer.Permission, workspace_name: str) None[source]

Recursive method to update all the path permissions of a resource and its children resources as found on Magpie.

_update_permissions_on_filesystem(permission: cowbird.permissions_synchronizer.Permission) None[source]

Updates the permissions of dir/files on the file system, after receiving a permission webhook event from Magpie.

permission_created(permission: cowbird.permissions_synchronizer.Permission) None[source]

Called when Magpie sends a permission created webhook event.

permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None[source]

Called when Magpie sends a permission deleted webhook event.

static get_instance() Geoserver | None[source]

Return the Geoserver singleton instance from the class name used to retrieve the FSMonitor from the DB.

static publish_shapefile_task_chain(workspace_name: str, shapefile_name: str) None[source]

Applies the chain of tasks required to publish a new file to Geoserver.

on_created(path: str) None[source]

Call when a new path is found.

Parameters:

path – Absolute path of a new file/directory

static remove_shapefile_task(workspace_name: str, shapefile_name: str) None[source]

Applies the celery task required to remove a shapefile from Geoserver.

on_deleted(path: str) None[source]

Called when a path is deleted.

Parameters:

path – Absolute path of a new file/directory

on_modified(path: str) None[source]

Called when a path is updated.

Parameters:

path – Absolute path of a new file/directory

abstract resync() None[source]
static _is_permission_update_required(effective_permissions: List[cowbird.typedefs.JSON], user_name: str, res_id: int, perm_name: str, perm_access: str, perm_scope: str, delete_if_required: bool = False) bool[source]

Checks if the required permission already exists on the resource, else returns true if an update is required.

Also, deletes the permission if the associated input argument is activated.

static _update_magpie_permissions(user_name: str, res_id: int, perm_scope: str, is_readable: bool, is_writable: bool) None[source]

Updates permissions on a Magpie resource (workspace/layer).

_update_magpie_workspace_permissions(workspace_name: str) None[source]

Updates the permissions of a workspace resource on Magpie to the current permissions found on the corresponding datastore folder.

_update_magpie_layer_permissions(workspace_name: str, layer_name: str) None[source]

Updates the permissions of a layer resource on Magpie to the current permissions found on the corresponding shapefile.

create_workspace(name: str) None[source]

Create a new Geoserver workspace.

Parameters:

name – Workspace name

remove_workspace(name: str) None[source]

Removes a workspace from geoserver. Will also remove all datastores associated with the workspace.

Parameters:

name – Workspace name

create_datastore(workspace_name: str) 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: str, 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: str, shapefile_name: str) None[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

_get_shapefile_permissions(workspace_name: str, shapefile_name: str) Tuple[bool, bool][source]

Resolves the shapefile permissions on the file system, by checking the shapefile’s main file permissions.

_normalize_shapefile_permissions(workspace_name: str, shapefile_name: str, is_readable: bool, is_writable: bool) None[source]

Makes sure all files associated with a shapefile is owned by the default user/group and have the same permissions.

remove_shapefile(workspace_name: str, 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: str) 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: str) 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: str, 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: str, 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: str, 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: str, 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: celery.Task[[str], None], user_name: str) None[source]
cowbird.handlers.impl.geoserver.create_datastore(_task: celery.Task[[str], None], datastore_name: str) None[source]
cowbird.handlers.impl.geoserver.remove_workspace(_task: celery.Task[[str], None], workspace_name: str) None[source]
cowbird.handlers.impl.geoserver.validate_shapefile(_task: celery.Task[[Any, Any], None], workspace_name: str, shapefile_name: str) None[source]
cowbird.handlers.impl.geoserver.publish_shapefile(_task: celery.Task[[Any, Any], None], workspace_name: str, shapefile_name: str) None[source]
cowbird.handlers.impl.geoserver.remove_shapefile(_task: celery.Task[[Any, Any], None], workspace_name: str, shapefile_name: str) None[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

WFS_READ_PERMISSIONS

WFS_WRITE_PERMISSIONS

WMS_READ_PERMISSIONS

WPS_READ_PERMISSIONS

WPS_WRITE_PERMISSIONS

GEOSERVER_READ_PERMISSIONS

GEOSERVER_WRITE_PERMISSIONS

cowbird.handlers.impl.magpie.LOGGER[source]
cowbird.handlers.impl.magpie.COOKIES_TIMEOUT = 60[source]
cowbird.handlers.impl.magpie.WFS_READ_PERMISSIONS[source]
cowbird.handlers.impl.magpie.WFS_WRITE_PERMISSIONS[source]
cowbird.handlers.impl.magpie.WMS_READ_PERMISSIONS[source]
cowbird.handlers.impl.magpie.WPS_READ_PERMISSIONS[source]
cowbird.handlers.impl.magpie.WPS_WRITE_PERMISSIONS[source]
cowbird.handlers.impl.magpie.GEOSERVER_READ_PERMISSIONS[source]
cowbird.handlers.impl.magpie.GEOSERVER_WRITE_PERMISSIONS[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: Any | None = None, json: Any | None = None) requests.Response[source]

Wrapping function to send requests to Magpie, which also handles login and cookies.

get_service_types() List[str][source]

Returns the list of service types available on Magpie.

get_services_by_type(service_type: str) Dict[str, cowbird.typedefs.JSON][source]
get_service_info(service_name: str) Dict[str, cowbird.typedefs.JSON][source]
get_resources_by_service(service_name: str) Dict[str, cowbird.typedefs.JSON][source]
get_parents_resource_tree(resource_id: int) List[cowbird.typedefs.JSON][source]

Returns the associated Magpie Resource object and all its parents in a list ordered from parent to child.

get_resource(resource_id: int) Dict[str, cowbird.typedefs.JSON][source]

Returns the associated Magpie Resource object.

get_geoserver_workspace_res_id(workspace_name: str, create_if_missing: bool | None = False) int | None[source]

Finds the resource id of a workspace resource from the geoserver type services.

get_geoserver_layer_res_id(workspace_name: str, layer_name: str, create_if_missing: bool = False) int[source]

Tries to get the resource id of a specific layer, on geoserver type services, and if requested, creates the resource and workspace if they do not exist yet.

get_user_list() List[str][source]

Returns the list of all Magpie usernames.

get_user_id_from_user_name(user_name: str) int[source]

Finds the id of a user from his username.

get_user_name_from_user_id(user_id: int) str[source]

Finds the name of a user from his user id.

get_user_permissions(user: str) Dict[str, cowbird.typedefs.JSON][source]

Gets all user resource permissions.

get_user_permissions_by_res_id(user: str, res_id: int, effective: bool = False) Dict[str, cowbird.typedefs.JSON][source]
get_user_names_by_group_name(grp_name: str) List[str][source]

Returns the list of Magpie usernames from a group.

get_group_permissions(grp: str) Dict[str, cowbird.typedefs.JSON][source]

Gets all group resource permissions.

get_group_permissions_by_res_id(grp: str, res_id: int, effective: bool = False) Dict[str, cowbird.typedefs.JSON][source]
abstract user_created(user_name: str) None[source]
abstract user_deleted(user_name: str) None[source]
permission_created(permission: magpie.permissions.Permission) None[source]
permission_deleted(permission: magpie.permissions.Permission) None[source]
abstract resync() None[source]
create_permissions(permissions_data: List[cowbird.typedefs.PermissionConfigItemType]) None[source]

Make sure that the specified permissions exist on Magpie.

create_permission_by_res_id(res_id: int, perm_name: str, perm_access: str, perm_scope: str, user_name: str | None = '', grp_name: str | None = '') pyramid.response.Response | None[source]
create_permission_by_user_and_res_id(user_name: str, res_id: int, perm_name: str, perm_access: str, perm_scope: str) pyramid.response.Response | None[source]
create_permission_by_grp_and_res_id(grp_name: str, res_id: int, perm_name: str, perm_access: str, perm_scope: str) pyramid.response.Response | None[source]
delete_permission_by_user_and_res_id(user_name: str, res_id: int, permission_name: str) None[source]
delete_permission_by_grp_and_res_id(grp_name: str, res_id: int, permission_name: str) None[source]
delete_permission(permissions_data: List[Dict[str, str]]) None[source]

Remove the specified permission from Magpie if it exists.

create_resource(resource_name: str, resource_type: str, parent_id: int | None) int[source]

Creates the specified resource in Magpie and returns the created resource id if successful.

delete_resource(resource_id: int) None[source]
login() requests.cookies.RequestsCookieJar[source]

Login to Magpie app using admin credentials.

exception cowbird.handlers.impl.magpie.MagpieHttpError[source]

Bases: Exception

Exception related to http requests done by the Magpie handler.

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

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 user_created(user_name: str) None[source]
abstract user_deleted(user_name: str) None[source]
abstract permission_created(permission: cowbird.permissions_synchronizer.Permission) None[source]
abstract permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None[source]
abstract resync() None[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 user_created(user_name: str) None[source]
abstract user_deleted(user_name: str) None[source]
abstract permission_created(permission: cowbird.permissions_synchronizer.Permission) None[source]
abstract permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None[source]
abstract resync() None[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: AnyHandlerParameter = 'priority'[source]
cowbird.handlers.handler.HANDLER_URL_PARAM: AnyHandlerParameter = 'url'[source]
cowbird.handlers.handler.HANDLER_WORKSPACE_DIR_PARAM: AnyHandlerParameter = '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.

abstract property required_params: List[AnyHandlerParameter][source]
__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.

json() cowbird.typedefs.JSON[source]
_user_workspace_dir(user_name: str) str[source]
abstract user_created(user_name: str) None[source]
abstract user_deleted(user_name: str) None[source]
abstract permission_created(permission: cowbird.permissions_synchronizer.Permission) None[source]
abstract permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None[source]
abstract resync() None[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: Literal[Catalog]) cowbird.handlers.impl.catalog.Catalog[source]
create_handler(name: Literal[FileSystem]) cowbird.handlers.impl.filesystem.FileSystem
create_handler(name: Literal[Geoserver]) cowbird.handlers.impl.geoserver.Geoserver
create_handler(name: Literal[Magpie]) cowbird.handlers.impl.magpie.Magpie
create_handler(name: Literal[Nginx]) cowbird.handlers.impl.nginx.Nginx
create_handler(name: Literal[Thredds]) cowbird.handlers.impl.thredds.Thredds
create_handler(name: str) cowbird.handlers.handler.Handler | None

Instantiates a new Handler implementation using its name, overwriting an existing instance if required.

get_handler(name: Literal[Catalog]) cowbird.handlers.impl.catalog.Catalog[source]
get_handler(name: Literal[FileSystem]) cowbird.handlers.impl.filesystem.FileSystem
get_handler(name: Literal[Geoserver]) cowbird.handlers.impl.geoserver.Geoserver
get_handler(name: Literal[Magpie]) cowbird.handlers.impl.magpie.Magpie
get_handler(name: Literal[Nginx]) cowbird.handlers.impl.nginx.Nginx
get_handler(name: Literal[Thredds]) cowbird.handlers.impl.thredds.Thredds
get_handler(name: str) cowbird.handlers.handler.Handler | None

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

Handler

Helper class that provides a standard way to create an ABC using

HandlerFactory

Create handler instance using handler name.

Functions

get_handlers(→ List[handler.Handler])

Obtains the handlers managed by the application.

Attributes

AnySettingsContainer

class cowbird.handlers.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.

abstract property required_params: List[AnyHandlerParameter]
__slots__

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.

json() cowbird.typedefs.JSON[source]
_user_workspace_dir(user_name: str) str[source]
abstract user_created(user_name: str) None[source]
abstract user_deleted(user_name: str) None[source]
abstract permission_created(permission: cowbird.permissions_synchronizer.Permission) None[source]
abstract permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None[source]
abstract resync() None[source]
class cowbird.handlers.HandlerFactory[source]

Create handler instance using handler name.

create_handler(name: Literal[Catalog]) cowbird.handlers.impl.catalog.Catalog[source]
create_handler(name: Literal[FileSystem]) cowbird.handlers.impl.filesystem.FileSystem
create_handler(name: Literal[Geoserver]) cowbird.handlers.impl.geoserver.Geoserver
create_handler(name: Literal[Magpie]) cowbird.handlers.impl.magpie.Magpie
create_handler(name: Literal[Nginx]) cowbird.handlers.impl.nginx.Nginx
create_handler(name: Literal[Thredds]) cowbird.handlers.impl.thredds.Thredds
create_handler(name: str) cowbird.handlers.handler.Handler | None

Instantiates a new Handler implementation using its name, overwriting an existing instance if required.

get_handler(name: Literal[Catalog]) cowbird.handlers.impl.catalog.Catalog[source]
get_handler(name: Literal[FileSystem]) cowbird.handlers.impl.filesystem.FileSystem
get_handler(name: Literal[Geoserver]) cowbird.handlers.impl.geoserver.Geoserver
get_handler(name: Literal[Magpie]) cowbird.handlers.impl.magpie.Magpie
get_handler(name: Literal[Nginx]) cowbird.handlers.impl.nginx.Nginx
get_handler(name: Literal[Thredds]) cowbird.handlers.impl.thredds.Thredds
get_handler(name: str) cowbird.handlers.handler.Handler | None

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.

cowbird.handlers.AnySettingsContainer[source]
cowbird.handlers.get_handlers(container: cowbird.typedefs.AnySettingsContainer | None = 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() FSMonitor | None[source]

Must return an instance of the class implementing FSMonitor.

abstract on_created(path: str) None[source]

Called when a new path is found.

Parameters:

path – Absolute path of a new file/directory

abstract on_deleted(path: str) None[source]

Called when a path is deleted.

Parameters:

path – Absolute path of a new file/directory

abstract on_modified(path: str) None[source]

Called when a path is updated.

Parameters:

path – Absolute path of a new file/directory

cowbird.monitoring.monitor
Module Contents
Classes

Monitor

Implementation of the watchdog FileSystemEventHandler class Allows to start/stop directory monitoring and

Attributes

LOGGER

MonitorKey

MonitorParameters

cowbird.monitoring.monitor.LOGGER[source]
cowbird.monitoring.monitor.MonitorKey[source]
cowbird.monitoring.monitor.MonitorParameters[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: 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()

property recursive: bool[source]
property path: str[source]
property callback: str[source]
property callback_instance: cowbird.monitoring.fsmonitor.FSMonitor[source]
property key: MonitorKey[source]

Return a dict that can be used as a unique key to identify this Monitor in a BD.

property is_alive: bool[source]

Returns true if the monitor observer exists and is currently running.

static get_fsmonitor_instance(callback: 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)

params() MonitorParameters[source]

Return a dict serializing this object from which a new Monitor can be recreated using the init function.

start() None[source]

Start the monitoring so that events can be fired.

stop() None[source]

Stop the monitoring so that events stop to be fired.

on_moved(event: 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: 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: 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: 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() None[source]

Load existing monitors and start the monitoring.

register(path: str, recursive: bool, cb_monitor: cowbird.monitoring.fsmonitor.FSMonitor | Type[cowbird.monitoring.fsmonitor.FSMonitor] | str) cowbird.monitoring.monitor.Monitor | None[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. Note that the monitor is not created/returned if a MonitorException occurs.

unregister(path: str, cb_monitor: 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

unregister_all() None[source]

Stops and unregisters all monitors.

Submodules
cowbird.__meta__

General meta information on the package.

Module Contents
cowbird.__meta__.__version__ = '2.2.0'[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(→ pyramid.router.Router)

This function returns the Pyramid WSGI application.

main(→ pyramid.router.Router)

This function returns the Pyramid WSGI application.

Attributes

LOGGER

cowbird.app.LOGGER[source]
cowbird.app.get_app(global_config: cowbird.typedefs.SettingsType | None = None, **settings: cowbird.typedefs.SettingValue) pyramid.router.Router[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: cowbird.typedefs.SettingsType | None = None, **settings: cowbird.typedefs.SettingValue) pyramid.router.Router[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(…)

Loads all configuration files specified by the path (if a directory), a single configuration (if a file) or directly

_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: 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: str | cowbird.typedefs.ConfigDict, section: Literal[handlers], allow_missing: bool = False) List[Dict[str, cowbird.typedefs.HandlerConfig]][source]
cowbird.config.get_all_configs(path_or_dict: str | cowbird.typedefs.ConfigDict, section: Literal[sync_permissions], allow_missing: bool = False) List[cowbird.typedefs.SyncPointConfig]

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: Dict[str, cowbird.typedefs.HandlerConfig]) None[source]

Validates the schema of the handlers section found in the config.

cowbird.config.validate_sync_perm_config_schema(sync_cfg: cowbird.typedefs.SyncPointConfig) 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[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.SyncPermissionConfig, 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.SyncPermissionConfig) None[source]
cowbird.config.validate_sync_config_services(sync_cfg: cowbird.typedefs.SyncPermissionConfig, available_services: List[str]) 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

DEFAULT_USER_UID

DEFAULT_USER_GID

DEFAULT_ADMIN_UID

DEFAULT_ADMIN_GID

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.DEFAULT_USER_UID[source]
cowbird.constants.DEFAULT_USER_GID[source]
cowbird.constants.DEFAULT_ADMIN_UID[source]
cowbird.constants.DEFAULT_ADMIN_GID[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: str, settings_container: cowbird.typedefs.AnySettingsContainer | None = None, settings_name: str | None = None, default_value: cowbird.typedefs.SettingValue | None = 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

TargetResourcePermissions

PermissionMapping

LOGGER

SEGMENT_NAME_REGEX

RES_NAMETYPE_SEPARATOR

PERMISSION_DEFAULT_ACCESS

PERMISSION_DEFAULT_SCOPE

cowbird.permissions_synchronizer.TargetResourcePermissions[source]
cowbird.permissions_synchronizer.PermissionMapping[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: str, service_type: str, resource_id: int, 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: cowbird.typedefs.SyncPointServicesType, permissions_mapping_list: cowbird.typedefs.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 type 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]) Tuple[str, int][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_type: str, resource_nametype_path: str) Tuple[str, Dict[str, 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_type – Type 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.

  • input_matched_groups

_get_resource_full_name_and_type(res_key: str, matched_groups: Dict[str, str]) Tuple[str, List[cowbird.typedefs.ResourceSegment]][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() Iterator[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_data: List[cowbird.typedefs.ResourceSegment], permissions: cowbird.typedefs.JSON) 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: TargetResourcePermissions, input_src_res_key: str, src_matched_groups: Dict[str, str], input_permission: Permission) Tuple[Dict[str, List[str]], Dict[str, List[str]]][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: TargetResourcePermissions, 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 synced 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[cowbird.typedefs.PermissionConfigItemType]], None]) cowbird.typedefs.PermissionData[source]

Finds all permissions that should be synchronised with the source resource.

sync(perm_operation: Callable[[List[cowbird.typedefs.PermissionConfigItemType]], None], permission: Permission, src_resource_tree: cowbird.typedefs.ResourceTree) 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() None[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.PermissionActionType: typing_extensions.TypeAlias = 'PermissionAction'[source]
cowbird.typedefs.PermissionConfigItemType: typing_extensions.TypeAlias = 'PermissionConfigItem'[source]
cowbird.typedefs.PermissionDictType: typing_extensions.TypeAlias = 'PermissionDict'[source]
cowbird.typedefs.StoreInterfaceType: typing_extensions.TypeAlias = 'StoreInterface'[source]
cowbird.typedefs.TestResponseType: typing_extensions.TypeAlias = 'TestResponse'[source]
cowbird.typedefs.Number[source]
cowbird.typedefs.SettingValue[source]
cowbird.typedefs.SettingsType[source]
cowbird.typedefs.AnySettingsContainer[source]
cowbird.typedefs.AnyRegistryContainer[source]
cowbird.typedefs.ParamsType[source]
cowbird.typedefs.CookiesType[source]
cowbird.typedefs.HeadersType[source]
cowbird.typedefs.AnyHeadersType[source]
cowbird.typedefs.AnyCookiesType[source]
cowbird.typedefs.AnyResponseType[source]
cowbird.typedefs.ValueType[source]
cowbird.typedefs.AnyValueType[source]
cowbird.typedefs.AnyKey[source]
cowbird.typedefs._JSON: typing_extensions.TypeAlias = 'JSON'[source]
cowbird.typedefs._JsonObjectItemAlias: typing_extensions.TypeAlias = '_JsonObjectItem'[source]
cowbird.typedefs._JsonListItemAlias: typing_extensions.TypeAlias = '_JsonListItem'[source]
cowbird.typedefs._JsonObjectItem[source]
cowbird.typedefs._JsonListItem[source]
cowbird.typedefs._JsonItem[source]
cowbird.typedefs.JSON[source]
cowbird.typedefs.HTTPMethod[source]
cowbird.typedefs.HandlerConfig[source]
cowbird.typedefs.ConfigItem[source]
cowbird.typedefs.ConfigList[source]
cowbird.typedefs.ConfigDict[source]
cowbird.typedefs.ConfigResTokenInfo[source]
cowbird.typedefs.ConfigSegment[source]
cowbird.typedefs.SyncPointMappingType[source]
cowbird.typedefs.SyncPointServicesType[source]
cowbird.typedefs.SyncPermissionConfig[source]
cowbird.typedefs.SyncPointConfig[source]
cowbird.typedefs.ResourceSegment[source]
cowbird.typedefs.ResourceTree[source]
cowbird.typedefs.PermissionResourceData[source]
cowbird.typedefs.PermissionDataEntry[source]
cowbird.typedefs.PermissionData[source]
cowbird.typedefs.StoreSelector[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(→ None)

get_app_config(→ pyramid.config.Configurator)

Generates application configuration with all required utilities and settings configured.

get_settings_from_config_ini(...)

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(→ cowbird.typedefs.JSON)

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(...)

Tween factory that logs any exception before re-raising it.

is_json_body(→ bool)

is_null(→ bool)

get_config_path(→ str)

get_ssl_verify(→ bool)

get_timeout(→ int)

apply_new_path_permissions(→ None)

Applies new permissions to a path, if required.

update_filesystem_permissions(→ int)

Applies/remove read, write and execute permissions (on others only) to the input file system permissions.

apply_default_path_ownership(→ None)

Applies default ownership to a path, if required.

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

EnumClassType

LOGGER

SingletonMetaType

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.EnumClassType[source]
cowbird.utils.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = 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: str | None = None, datetime_format: str | None = None) logging.Logger[source]

Applies the provided logging configuration settings to the logger.

cowbird.utils.print_log(msg: str, logger: logging.Logger | None = 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: logging.Logger | None = 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: pyramid.config.Configurator, config_ini: str) None[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: str, section: str | None = None) cowbird.typedefs.SettingsType[source]

Loads configuration INI settings with additional handling.

cowbird.utils.get_registry(container: cowbird.typedefs.AnyRegistryContainer, nothrow: bool = False) pyramid.registry.Registry | None[source]

Retrieves the application registry from various containers referencing to it.

cowbird.utils.get_json(response: cowbird.typedefs.AnyResponseType) cowbird.typedefs.JSON[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: str | None = None, split: str | List[str] | None = None) str | None[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: cowbird.typedefs.AnySettingsContainer | None, app: bool = False) cowbird.typedefs.SettingsType[source]

Retrieve application settings from a supported container.

Parameters:
  • container – supported container with a 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: 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: Callable[[pyramid.request.Request], cowbird.typedefs.AnyResponseType], registry: pyramid.registry.Registry) Callable[[pyramid.request.Request], cowbird.typedefs.AnyResponseType][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 | EnumClassType, default: Any | None = None) EnumClassType | None[source]

Finds an enum entry by defined name or its value.

Returns the entry directly if it is already a valid enum.

cowbird.utils.SingletonMetaType: typing_extensions.TypeAlias = 'SingletonMeta'[source]
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: Dict[SingletonMetaType, SingletonMetaType][source]
__call__(*args: Any, **kwargs: Any) SingletonMetaType[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__() str[source]

Return repr(self).

static __nonzero__() bool[source]
cowbird.utils.null[source]
cowbird.utils.is_null(item: Any) bool[source]
cowbird.utils.get_config_path(container: cowbird.typedefs.AnySettingsContainer | None = None) str[source]
cowbird.utils.get_ssl_verify(container: cowbird.typedefs.AnySettingsContainer | None = None) bool[source]
cowbird.utils.get_timeout(container: cowbird.typedefs.AnySettingsContainer | None = None) int[source]
cowbird.utils.apply_new_path_permissions(path: str, is_readable: bool, is_writable: bool, is_executable: bool) None[source]

Applies new permissions to a path, if required.

cowbird.utils.update_filesystem_permissions(permission: int, is_readable: bool, is_writable: bool, is_executable: bool) int[source]

Applies/remove read, write and execute permissions (on others only) to the input file system permissions.

Note that others permissions are used instead of the user/group permissions, to manage the user’s data access. See Components - Usage of ‘others’ permissions for more details on the usage of others permissions.

cowbird.utils.apply_default_path_ownership(path: str) None[source]

Applies default ownership to a path, if required.

Package Contents
Functions

includeme(→ None)

cowbird.includeme(config: pyramid.config.Configurator) None[source]

view

Module Contents
Classes

view_config

Attributes

ViewCallable

view.ViewCallable[source]
class view.view_config(*, route_name: str, request_method: cowbird.typedefs.HTTPMethod, permission: str | None = None)[source]
__call__(view: ViewCallable) ViewCallable[source]

request

Module Contents
Classes

Request

class request.Request[source]
property registry: pyramid.registry.Registry[source]
accept: str | None[source]
method: cowbird.typedefs.HTTPMethod[source]
upath_info: str[source]
url: str[source]
json_body: cowbird.typedefs.JSON[source]

__init__

Package Contents
Classes

SharedTaskCallable

Base class for protocol classes.

shared_task

class __init__.SharedTaskCallable[source]

Bases: Protocol

Base class for protocol classes.

Protocol classes are defined as:

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:

class GenProto(Protocol[T]):
    def meth(self) -> T:
        ...
__call__(*args: Any, **kwargs: Any) Callable[[celery.local.Proxy], celery.Task[Any, Any]][source]
class __init__.shared_task(bind: bool = False, base: celery.Task[Any, Any] | None = None, typing: bool = False, autoretry_for: Tuple[Type[Exception], Ellipsis] | None = None, retry_backoff: bool = False, max_retries: int = 0)[source]
__call__(task: celery.Task[Any, Any], *args: Any, **kwargs: Any) SharedTaskCallable[source]

tests

Submodules
tests.test_api

Tests for cowbird.api module.

Module Contents
Classes

TestAPI

Test API operations of application.

Functions

test_response_metadata()

Validate that regardless of response type (success/error) and status-code, metadata details are added.

class tests.test_api.TestAPI(methodName='runTest')[source]

Bases: unittest.TestCase

Test API operations of application.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_homepage()[source]
test_webhooks()[source]

Test that sends a webhook request from Magpie to cowbird.

tests.test_api.test_response_metadata()[source]

Validate that regardless of response type (success/error) and status-code, metadata details are added.

note: test only locally to avoid remote server side-effects and because mock cannot be done remotely

tests.test_cli

Tests for cowbird.cli module.

Module Contents
Functions

run_and_get_output(command[, trim])

test_cowbird_helper_help()

test_cowbird_helper_as_python()

test_cowbird_handlers_list_with_formats()

Attributes

KNOWN_HELPERS

CURR_DIR

tests.test_cli.KNOWN_HELPERS = ['handlers'][source]
tests.test_cli.CURR_DIR[source]
tests.test_cli.run_and_get_output(command, trim=True)[source]
tests.test_cli.test_cowbird_helper_help()[source]
tests.test_cli.test_cowbird_helper_as_python()[source]
tests.test_cli.test_cowbird_handlers_list_with_formats()[source]
tests.test_constants
Module Contents
Functions

test_get_constant_with_same_name()

test_get_constant_with_settings()

test_get_constant_alternative_name()

test_get_constant_raise_missing_when_requested()

test_get_constant_raise_not_set_when_requested()

test_constant_prioritize_setting_before_env_when_specified()

test_constant_protected_no_override()

tests.test_constants.test_get_constant_with_same_name()[source]
tests.test_constants.test_get_constant_with_settings()[source]
tests.test_constants.test_get_constant_alternative_name()[source]
tests.test_constants.test_get_constant_raise_missing_when_requested()[source]
tests.test_constants.test_get_constant_raise_not_set_when_requested()[source]
tests.test_constants.test_constant_prioritize_setting_before_env_when_specified()[source]
tests.test_constants.test_constant_protected_no_override()[source]
tests.test_filesystem
Module Contents
Classes

BaseTestFileSystem

Base test FileSystem parent class, containing some utility functions and common setup/teardown operations.

TestFileSystemBasic

Test FileSystem generic operations.

TestFileSystemWpsOutputsUser

FileSystem tests specific to the user wps outputs data.

Attributes

CURR_DIR

tests.test_filesystem.CURR_DIR[source]
class tests.test_filesystem.BaseTestFileSystem(methodName='runTest')[source]

Bases: unittest.TestCase

Base test FileSystem parent class, containing some utility functions and common setup/teardown operations.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

get_test_app(cfg_data: cowbird.typedefs.JSON) webtest.app.TestApp[source]
static check_created_test_cases(output_path, hardlink_path)[source]

Runs multiple test cases, common to the public and user files, for the creation of hardlinks.

class tests.test_filesystem.TestFileSystemBasic(methodName='runTest')[source]

Bases: BaseTestFileSystem

Test FileSystem generic operations.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_manage_user_workspace(mock_head_request)[source]

Tests creating and deleting a user workspace.

test_create_user_missing_workspace_dir(mock_head_request)[source]

Tests creating a user directory with a missing workspace directory.

test_public_wps_output_created()[source]

Tests creating a public wps output file.

test_public_wps_output_deleted()[source]

Tests deleting a public wps output path.

test_resync()[source]

Tests resync operation for the handler.

test_resync_no_src_wps_outputs()[source]

Tests the resync operation when the source WPS outputs folder does not exist.

class tests.test_filesystem.TestFileSystemWpsOutputsUser(methodName='runTest')[source]

Bases: BaseTestFileSystem

FileSystem tests specific to the user wps outputs data.

These tests can include verifications on the different path permissions. Note that others permissions are used instead of the user/group permissions, to manage the user’s data access. See Components - Usage of ‘others’ permissions for more details on the usage of others permissions.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

create_secure_data_proxy_service()[source]

Generates a new secure-data-proxy service in Magpie app.

Checks if a path has the expected permissions, and if a hardlink exists, according to the other permissions.

test_user_wps_output_created()[source]

Tests creating wps outputs for a user.

test_user_created()[source]

Tests if creating a user generates the hardlinks to the pre-existing user WPS outputs data.

test_user_wps_output_created_secure_data_proxy()[source]

Tests creating wps outputs for a user when Magpie uses a secure-data-proxy service to manage access permissions to the wps output data.

test_user_wps_output_deleted()[source]

Tests deleting wps outputs for a user.

test_resync()[source]

Tests resync operation on WPS outputs user data.

test_permission_updates_user_data()[source]

Tests updating permissions on data found directly in a specific user directory.

test_permission_updates_wps_outputs_data()[source]

Tests updating permissions on data found outside of the user directories, including testing permissions on a user and on a group.

test_permission_updates_other_svc()[source]

Tests permission updates on a WPS outputs resource from a service other than the secure-data-proxy, which should not be processed by the filesystem handler.

tests.test_geoserver

These tests require a working Geoserver instance.

They can be run with the Make test-geoserver target. More integration tests should be in Jupyter Notebook format as is the case with Birdhouse-deploy / DACCS platform.

Module Contents
Classes

TestGeoserver

TestGeoserverRequests

TestGeoserverPermissions

Test cases to validate the synchronization between Magpie permissions and file permissions in a Geoserver workspace.

Functions

get_geoserver_settings()

Setup basic parameters for an unmodified local test run (using the example files) unless environment variables are

prepare_geoserver_test_workspace(→ Tuple[str, str])

Prepares a workspace, its datastore and a test shapefile along with the associated Geoserver resources.

reset_geoserver_test_workspace(test_instance, ...)

Removes a workspace on the file system and the associated resources on Geoserver.

copy_shapefile(→ None)

get_datastore_path(→ str)

Attributes

CURR_DIR

tests.test_geoserver.CURR_DIR[source]
tests.test_geoserver.get_geoserver_settings()[source]

Setup basic parameters for an unmodified local test run (using the example files) unless environment variables are set.

tests.test_geoserver.prepare_geoserver_test_workspace(test_instance: TestGeoserver, geoserver_handler: cowbird.handlers.impl.geoserver.Geoserver, workspace_key: str) Tuple[str, str][source]

Prepares a workspace, its datastore and a test shapefile along with the associated Geoserver resources.

tests.test_geoserver.reset_geoserver_test_workspace(test_instance, geoserver_handler)[source]

Removes a workspace on the file system and the associated resources on Geoserver.

tests.test_geoserver.copy_shapefile(basename: str, destination: str) None[source]
tests.test_geoserver.get_datastore_path(workspace_path: str) str[source]
class tests.test_geoserver.TestGeoserver[source]
geoserver_settings[source]
workspaces[source]
workspace_folders[source]
test_shapefile_name = 'Espace_Vert'[source]
teardown_class()[source]
static get_geoserver()[source]
class tests.test_geoserver.TestGeoserverRequests[source]

Bases: TestGeoserver

workspaces[source]
workspace_folders[source]
teardown_class()[source]
geoserver()[source]
test_workspace_creation(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_empty_workspace_removal(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_duplicate_workspace(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_workspace_removal(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_datastore_creation(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_datastore_creation_missing_workspace(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_datastore_configuration(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_duplicate_datastore(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
test_publish_and_remove_shapefile(geoserver: cowbird.handlers.impl.geoserver.Geoserver) None[source]
class tests.test_geoserver.TestGeoserverPermissions[source]

Bases: TestGeoserver

Test cases to validate the synchronization between Magpie permissions and file permissions in a Geoserver workspace.

See Components - Geoserver for more details on the design/implementation choices.

setup_class()[source]
teardown_class()[source]
setup(tmpdir)[source]
check_magpie_permissions(res_id, expected_perms, expected_access=Access.ALLOW.value, expected_scope=Scope.MATCH.value, effective=True)[source]

Checks if a resource has the expected permissions on Magpie for a specific access and scope value.

test_shapefile_on_created()[source]

Tests if the right Magpie permissions are created upon a shapefile creation in a Geoserver workspace.

test_shapefile_on_modified()[source]

Tests if the right Magpie permissions are updated upon a shapefile permission modification in a Geoserver workspace.

test_shapefile_on_modified_other_ext()[source]

Tests modification events on any other file of the shapefile that does not have the main extension (.shp), which should not trigger any other event or modification.

test_shapefile_on_deleted()[source]

Tests if the right Magpie permissions are deleted upon a shapefile removal in a Geoserver workspace.

test_workspace_on_created()[source]
test_workspace_on_modified()[source]

Tests if Magpie resources associated with the user workspace are updated correctly.

test_workspace_on_deleted(caplog)[source]

Tests if Magpie resources associated with the user workspace are deleted only when a user_deleted event is triggered.

test_magpie_layer_permissions()[source]

Tests modifications on layer permissions on Magpie and the resulting updates of the permissions on the related files.

apply_and_check_recursive_permissions(resource_id, resource_name)[source]

Used in different test cases to check the creation and deletion of a recursive permission on Magpie, validating if the resource’s files and all the children resources’ files are updated.

test_magpie_workspace_permission()[source]

Tests modifications on a workspace’s recursive permissions on Magpie and the updates of the related files.

test_magpie_service_permission()[source]

Tests modifications on a service’s recursive permissions on Magpie and the updates of the related files.

test_group_permission()[source]

Tests modifications on a resource’s group permission, which should not trigger any change to the associated path on the file system, since the Geoserver handler does not support groups.

tests.test_handler_factory
Module Contents
Classes

TestHandlerFactory

A class whose instances are single test cases.

BadHandler

Helper class that provides a standard way to create an ABC using

BadParamHandler

Helper class that provides a standard way to create an ABC using

GoodHandler

Helper class that provides a standard way to create an ABC using

Attributes

INVALID_PARAM_NAME

tests.test_handler_factory.INVALID_PARAM_NAME = 'Invalid_param_name'[source]
class tests.test_handler_factory.TestHandlerFactory(methodName='runTest')[source]

Bases: unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Setup a config where 1 handler is set inactive.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_handler_factory()[source]
test_handler_configuration()[source]
class tests.test_handler_factory.BadHandler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]

Bases: tests.utils.MockAnyHandlerBase

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.

class tests.test_handler_factory.BadParamHandler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]

Bases: tests.utils.MockAnyHandlerBase

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.

required_params[source]
class tests.test_handler_factory.GoodHandler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]

Bases: tests.utils.MockAnyHandlerBase

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.

required_params[source]
tests.test_magpie
Module Contents
Classes

TestMagpie

Tests different methods found in the Magpie handler.

Functions

create_user(→ int)

delete_user(→ None)

create_group(→ int)

delete_group(→ None)

create_service(→ int)

delete_service(→ None)

delete_all_services(→ None)

Attributes

CURR_DIR

tests.test_magpie.CURR_DIR[source]
tests.test_magpie.create_user(magpie: cowbird.handlers.impl.magpie.Magpie, user_name: str, email: str, password: str, group_name: str) int[source]
tests.test_magpie.delete_user(magpie: cowbird.handlers.impl.magpie.Magpie, user_name: str) None[source]
tests.test_magpie.create_group(magpie: cowbird.handlers.impl.magpie.Magpie, group_name: str, descr: str, discoverable: bool, terms: str) int[source]
tests.test_magpie.delete_group(magpie: cowbird.handlers.impl.magpie.Magpie, group_name: str) None[source]
tests.test_magpie.create_service(magpie: cowbird.handlers.impl.magpie.Magpie, service_data: Dict[str, str]) int[source]
tests.test_magpie.delete_service(magpie: cowbird.handlers.impl.magpie.Magpie, service_name: str) None[source]
tests.test_magpie.delete_all_services(magpie: cowbird.handlers.impl.magpie.Magpie) None[source]
class tests.test_magpie.TestMagpie[source]

Tests different methods found in the Magpie handler.

These tests require a running instance of Magpie.

setup_class()[source]
setup(tmpdir)[source]
test_get_or_create_layer_resource_id()[source]

Tests the method used with geoserver to get a layer resource id.

test_create_permission_by_res_id()[source]

Tests the method used to create a permission on a specific resource id.

tests.test_mongodb
Module Contents
Classes

MongodbServiceStoreTestCase

A class whose instances are single test cases.

class tests.test_mongodb.MongodbServiceStoreTestCase(methodName='runTest')[source]

Bases: unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_get_store()[source]
test_save_monitor()[source]
test_delete_monitor()[source]
test_list_monitors()[source]
tests.test_monitoring
Module Contents
Classes

TestMonitoring

A class whose instances are single test cases.

TestMonitor

Interface being called when something changes on the filesystem.

TestMonitor2

Interface being called when something changes on the filesystem.

Functions

file_io(filename, mv_filename)

tests.test_monitoring.file_io(filename, mv_filename)[source]
class tests.test_monitoring.TestMonitoring(methodName='runTest')[source]

Bases: unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_register_unregister_monitor()[source]
class tests.test_monitoring.TestMonitor[source]

Bases: cowbird.monitoring.fsmonitor.FSMonitor

Interface being called when something changes on the filesystem.

__test__ = False[source]
static get_instance()[source]

Must return an instance of the class implementing FSMonitor.

on_created(path)[source]

Called when a new path is found.

Parameters:

path – Absolute path of a new file/directory

on_deleted(path)[source]

Called when a path is deleted.

Parameters:

path – Absolute path of a new file/directory

on_modified(path)[source]

Called when a path is updated.

Parameters:

path – Absolute path of a new file/directory

class tests.test_monitoring.TestMonitor2[source]

Bases: TestMonitor

Interface being called when something changes on the filesystem.

__test__ = False[source]
static get_instance()[source]

Must return an instance of the class implementing FSMonitor.

tests.test_permissions_synchronizer
Module Contents
Classes

TestSyncPermissions

Test permissions synchronization.

TestSyncPermissionsConfig

Tests different config setups for permissions synchronization.

Functions

check_config(→ None)

Checks if the config loads without error, or if it triggers the expected exception in the case of an invalid config.

Attributes

CURR_DIR

tests.test_permissions_synchronizer.CURR_DIR[source]
class tests.test_permissions_synchronizer.TestSyncPermissions(methodName='runTest')[source]

Bases: unittest.TestCase

Test permissions synchronization.

These tests parse the sync config and checks that when a permission is created/deleted in the PermissionSynchronizer the proper permissions are created/deleted for every synchronized service. These tests require a running instance of Magpie.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

reset_test_service()[source]

Generates a new test service in Magpie app.

delete_test_service()[source]

Deletes the test service if it exists.

create_test_permission(resource_id: int, perm_name: magpie.permissions.Permission, perm_access: magpie.permissions.Access, perm_scope: magpie.permissions.Scope, user_name: str, group_name: str) None[source]

Creates a test permission in Magpie app.

delete_test_permission(resource_id: int, permission_name: magpie.permissions.Permission, user_name: str, group_name: str) None[source]

Creates a test permission in Magpie app.

check_user_permissions(resource_id: int, expected_permissions: List) None[source]

Checks if the test user has the expected_permissions on the resource_id.

check_group_permissions(resource_id: int, expected_permissions: List) None[source]

Checks if the test group has the expected_permissions on the resource_id.

test_webhooks_no_tokens()[source]

Tests the permissions synchronization of resources that don’t use any tokens in the config.

test_webhooks_valid_tokens()[source]

Tests the permissions synchronization of resources that use valid tokens in the config.

test_webhooks_invalid_multimatch()[source]

Tests the invalid case where a resource in the incoming webhook matches multiple resource keys in the config.

test_webhooks_no_match()[source]

Tests the case where a resource found in the incoming webhook finds no match in the config.

test_webhooks_invalid_service()[source]

Tests the case where a service used in the sync_permissions section of the config is invalid.

tests.test_permissions_synchronizer.check_config(config_data: Dict, expected_exception_type: Type[Exception] = None) None[source]

Checks if the config loads without error, or if it triggers the expected exception in the case of an invalid config.

class tests.test_permissions_synchronizer.TestSyncPermissionsConfig(methodName='runTest')[source]

Bases: unittest.TestCase

Tests different config setups for permissions synchronization.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_not_unique_multitoken()[source]

Tests if config respects the constraint of using maximum one MULTI_TOKEN in a single resource.

test_not_unique_named_token()[source]

Tests an invalid config where duplicate named tokens are used in a single resource.

test_unknown_res_key()[source]

Tests an invalid config where an unknown resource key is found in the permissions_mapping.

test_duplicate_resource_key()[source]

Tests an invalid config where the same resource key is used for different resources.

test_invalid_mapping_format()[source]

Tests an invalid config where a permissions_mapping uses an invalid format.

test_multi_token_bidirectional()[source]

Tests the usage of MULTI_TOKEN in a bidirectional mapping.

test_unidirectional_multi_token()[source]

Tests the usage of MULTI_TOKEN in a unidirectional mapping.

test_bidirectional_named_tokens()[source]

Tests config with a bidirectional mapping that uses named tokens.

test_unidirectional_named_tokens()[source]

Tests config with a unidirectional mapping that uses named tokens.

test_cross_service_mappings()[source]

Tests config that uses mappings between permissions of different services.

tests.test_request_task

Helpful documentation on how to setup celery test fixtures:

https://medium.com/@scythargon/how-to-use-celery-pytest-fixtures-for-celery-integration-testing-6d61c91775d9.

TL;DR : - Add a session fixture with an in-memory celery config. - Use the celery_session_app and celery_session_worker fixtures for the tests. - Don’t forget to use the shared_task decorator instead of the usual app.task because shared_task uses

a proxy allowing the task to be bound to any app (including the celery_session_app fixture).

Module Contents
Classes

UnreliableRequestTask

Celery base task that should be used to handle API requests.

TestRequestTask

A class whose instances are single test cases.

Functions

celery_config()

unreliable_request_task(→ int)

abort_sum_task(→ int)

sum_task(→ int)

tests.test_request_task.celery_config()[source]
class tests.test_request_task.UnreliableRequestTask[source]

Bases: cowbird.request_task.RequestTask, 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.

retry_jitter = False[source]
test_max_retries = 3[source]
invoke_time = [][source]
__call__(*args, **kwargs)[source]
tests.test_request_task.unreliable_request_task(self: cowbird.request_task.RequestTask, param1: int, param2: int) int[source]
tests.test_request_task.abort_sum_task(self: cowbird.request_task.RequestTask, param1: int, param2: int) int[source]
tests.test_request_task.sum_task(param1: int, param2: int) int[source]
class tests.test_request_task.TestRequestTask(methodName='runTest')[source]

Bases: unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

test_chain()[source]
test_retrying()[source]
test_aborting()[source]
test_geoserver_user_created(create_workspace_mock, create_datastore_mock, create_datastore_dir_mock)[source]
test_geoserver_workspace_datastore_created(create_workspace_request_mock, create_datastore_request_mock, configure_datastore_request_mock, _create_datastore_dir_mock)[source]
test_geoserver_user_deleted(remove_workspace_mock)[source]
test_geoserver_workspace_removed(remove_workspace_request_mock)[source]
test_geoserver_file_creation(validate_shapefile_mock, publish_shapefile_request_mock)[source]
test_geoserver_file_removal(remove_shapefile_request_mock)[source]
tests.test_utils

Tests for the various utility operations.

Module Contents
Classes

DummyEnum

Utility enum.Enum methods.

TestUtils

A class whose instances are single test cases.

class tests.test_utils.DummyEnum[source]

Bases: cowbird.utils.ExtendedEnum

Utility enum.Enum methods.

Create an extended enum with these utilities as follows:

class CustomEnum(ExtendedEnum):
    ItemA = "A"
    ItemB = "B"
VALUE1 = 'value-1'[source]
VALUE2 = 'value-2'[source]
class tests.test_utils.TestUtils(methodName='runTest')[source]

Bases: unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

test_get_header_split()[source]
test_get_query_param()[source]
test_verify_param_proper_verifications_raised()[source]
test_verify_param_proper_verifications_passed()[source]
test_verify_param_args_incorrect_usage()[source]

Invalid usage of function raises internal server error instead of ‘normal HTTP error’.

test_verify_param_compare_types()[source]

Arguments param and param_compare must be of same type for valid comparison, except for is_type where compare parameter must be the type directly.

Changed in version 2.0: Since param can come from user input, we should NOT raise HTTPInternalServerError because the whole point of the method is to ensure that values are compared accordingly in a controlled fashion. Therefore, error to be raised is an ‘expected’ validation failure (HTTPBadRequest or whichever http_error provided) instead of runtime ‘unexpected’ processing error.

On the other hand, when is_type flag is requested, we know that param_compare must be a type. Inversely, param_compare must not be a type if is_type is not requested, but other flags require some form of comparison between values. We evaluate these use cases here.

See also

test_enum_values_listing()[source]
test_enum_get_by_value()[source]
test_enum_other()[source]
test_evaluate_call_callable_incorrect_usage()[source]

Verifies that incorrect usage of utility is raised accordingly.

test_evaluate_call_recursive_safeguard()[source]

Validate use case if internal function that handles formatting and generation of a resulting HTTP response raises itself an error (because of implementation issue), while it is processing another pre-raised error, that it does not end up into an endless recursive call stack of raised errors.

test_format_content_json_str_invalid_usage()[source]
test_generate_response_http_format_invalid_usage()[source]
test_guess_target_format_default()[source]
tests.utils
Module Contents
Classes

TestAppContainer

TestVersion

Special version supporting latest keyword to ignore safeguard check of warn_version() during development.

MockMagpieHandler

Helper class that provides a standard way to create an ABC using

MockAnyHandlerBase

Helper class that provides a standard way to create an ABC using

MockAnyHandler

Helper class that provides a standard way to create an ABC using

Functions

clear_handlers_instances()

config_setup_from_ini(config_ini_file_path)

get_test_app(→ webtest.app.TestApp)

Instantiate a local test application.

get_app_or_url(→ TestAppOrUrlType)

Obtains the referenced test application, local application or remote URL from Test Case implementation.

get_hostname(→ str)

Obtains stored hostname in the class implementation.

get_headers(→ cowbird.typedefs.HeadersType)

Obtains stored headers in the class implementation.

get_response_content_types_list(→ List[str])

Obtains the specified response Content-Type header(s) without additional formatting parameters.

get_json_body(→ cowbird.typedefs.JSON)

Obtains the JSON payload of the response regardless of its class implementation.

json_msg(→ str)

Generates a message string with formatted JSON body for display with easier readability.

mock_get_settings(test)

Decorator to mock cowbird.utils.get_settings() to allow retrieval of settings from DummyRequest.

mock_request(→ pyramid.request.Request)

Generates a fake request with provided arguments.

test_request(→ cowbird.typedefs.AnyResponseType)

Calls the request using either a webtest.TestApp instance or requests.Request from a string URL.

visual_repr(→ str)

format_test_val_ref(val, ref[, pre, msg])

all_equal(iter_val, iter_ref[, any_order])

check_all_equal(→ None)

param iter_val:

tested values.

check_val_equal(→ None)

raises AssertionError:

if val is not equal to ref.

check_val_not_equal(→ None)

raises AssertionError:

if val is equal to ref.

check_val_is_in(→ None)

raises AssertionError:

if val is not in to ref.

check_val_not_in(→ None)

raises AssertionError:

if val is in to ref.

check_val_type(→ None)

raises AssertionError:

if val is not an instanced of ref.

check_raises(→ Exception)

Calls the callable and verifies that the specific exception was raised.

check_no_raise(→ Any)

Calls the callable and verifies that no exception was raised.

check_response_basic_info(...)

Validates basic Cowbird API response metadata. For UI pages, employ check_ui_response_basic_info() instead.

check_error_param_structure(→ None)

Validates error response param information based on different Cowbird version formats.

check_path_permissions(→ None)

Checks if the path has the right permissions, by verifying the last digits of the octal permissions.

check_mock_has_calls(mocked_fct, calls)

Attributes

TEST_INI_FILE

TEST_CFG_FILE

LOGGER

TestAppOrUrlType

AnyTestItemType

_TestVersion

LatestVersion

AnyTestVersion

tests.utils.TEST_INI_FILE[source]
tests.utils.TEST_CFG_FILE[source]
tests.utils.LOGGER[source]
class tests.utils.TestAppContainer[source]

Bases: object

test_app: webtest.app.TestApp | None[source]
app: webtest.app.TestApp | None[source]
url: str | None[source]
tests.utils.TestAppOrUrlType[source]
tests.utils.AnyTestItemType[source]
tests.utils._TestVersion: typing_extensions.TypeAlias = 'TestVersion'[source]
tests.utils.LatestVersion[source]
tests.utils.AnyTestVersion[source]
class tests.utils.TestVersion(vstring: AnyTestVersion)[source]

Bases: packaging.version.Version

Special version supporting latest keyword to ignore safeguard check of warn_version() during development.

See also

Environment variable COWBIRD_TEST_VERSION should be set with the desired version or latest to evaluate even new features above the last tagged version.

Initialize a Version object.

Parameters:

version – The string representation of a version which will be parsed and normalized before use.

Raises:

InvalidVersion – If the version does not conform to PEP 440 in any way then this exception will be raised.

property version: Tuple[int | str, Ellipsis] | str[source]
__test__ = False[source]
_cmp(other: Any) int[source]
__lt__(other: Any) bool[source]

Return self<value.

__le__(other: Any) bool[source]

Return self<=value.

__gt__(other: Any) bool[source]

Return self>value.

__ge__(other: Any) bool[source]

Return self>=value.

__eq__(other: Any) bool[source]

Return self==value.

__ne__(other: Any) bool[source]

Return self!=value.

class tests.utils.MockMagpieHandler(settings, name, **kwargs)[source]

Bases: cowbird.handlers.handler.Handler

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.

required_params = [][source]
json()[source]
get_geoserver_workspace_res_id(user_name)[source]
user_created(user_name)[source]
user_deleted(user_name)[source]
permission_created(permission)[source]
permission_deleted(permission)[source]
create_permission(permission)[source]
delete_permission(permission)[source]
delete_resource(res_id)[source]
resync()[source]
static get_service_types() List[str][source]

Returns the list of service types available on Magpie.

class tests.utils.MockAnyHandlerBase(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]

Bases: cowbird.handlers.handler.Handler

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.

ResourceId = 1000[source]
user_created(user_name)[source]
user_deleted(user_name)[source]
permission_created(permission)[source]
permission_deleted(permission)[source]
resync()[source]
class tests.utils.MockAnyHandler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]

Bases: MockAnyHandlerBase

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.

required_params = [][source]
tests.utils.clear_handlers_instances()[source]
tests.utils.config_setup_from_ini(config_ini_file_path)[source]
tests.utils.get_test_app(settings: cowbird.typedefs.SettingsType | None = None) webtest.app.TestApp[source]

Instantiate a local test application.

tests.utils.get_app_or_url(test_item: AnyTestItemType) TestAppOrUrlType[source]

Obtains the referenced test application, local application or remote URL from Test Case implementation.

tests.utils.get_hostname(test_item: AnyTestItemType) str[source]

Obtains stored hostname in the class implementation.

tests.utils.get_headers(app_or_url: TestAppOrUrlType, header_dict: cowbird.typedefs.AnyHeadersType) cowbird.typedefs.HeadersType[source]

Obtains stored headers in the class implementation.

tests.utils.get_response_content_types_list(response: cowbird.typedefs.AnyResponseType) List[str][source]

Obtains the specified response Content-Type header(s) without additional formatting parameters.

tests.utils.get_json_body(response: cowbird.typedefs.AnyResponseType) cowbird.typedefs.JSON[source]

Obtains the JSON payload of the response regardless of its class implementation.

tests.utils.json_msg(json_body: cowbird.typedefs.JSON, msg: str | None = null) str[source]

Generates a message string with formatted JSON body for display with easier readability.

tests.utils.mock_get_settings(test)[source]

Decorator to mock cowbird.utils.get_settings() to allow retrieval of settings from DummyRequest.

Warning

Only apply on test methods (not on class TestCase) to ensure that pytest can collect them correctly.

tests.utils.mock_request(request_path_query: str = '', method: str = 'GET', params: Dict[str, str] | None = None, body: str | cowbird.typedefs.JSON = '', content_type: str | None = None, headers: cowbird.typedefs.AnyHeadersType | None = None, cookies: cowbird.typedefs.AnyCookiesType | None = None, settings: cowbird.typedefs.SettingsType = None) pyramid.request.Request[source]

Generates a fake request with provided arguments.

Can be employed by functions that expect a request object as input to retrieve details such as body content, the request path, or internal settings, but that no actual request needs to be accomplished.

tests.utils.test_request(test_item: AnyTestItemType, method: str, path: str, data: cowbird.typedefs.JSON | str | None = None, json: cowbird.typedefs.JSON | str | None = None, body: cowbird.typedefs.JSON | str | None = None, params: Dict[str, str] | None = None, timeout: int = 10, retries: int = 3, allow_redirects: bool = True, content_type: str | None = None, headers: cowbird.typedefs.AnyHeadersType | None = None, cookies: cowbird.typedefs.AnyCookiesType | None = None, **kwargs: Any) cowbird.typedefs.AnyResponseType[source]

Calls the request using either a webtest.TestApp instance or requests.Request from a string URL.

Keyword arguments json, data and body are all looked for to obtain the data.

Header Content-Type is set with respect to explicit json or via provided headers when available. Explicit content_type can also be provided to override all of these.

Request cookies are set according to cookies, or can be interpreted from Set-Cookie header.

Warning

When using TestApp, some internal cookies can be stored from previous requests to retain the active user. Make sure to provide new set of cookies (or logout user explicitly) if different session must be used, otherwise they will be picked up automatically. For ‘empty’ cookies, provide an empty dictionary.

Parameters:
  • test_item – one of BaseTestCase, webtest.TestApp or remote server URL to call with requests

  • method – request method (GET, POST, PATCH, PUT, DELETE)

  • path – test path starting at base path that will be appended to the application’s endpoint.

  • params – query parameters added to the request path.

  • json – explicit JSON body content to use as request body.

  • data – body content string to use as request body, can be JSON if matching Content-Type is identified.

  • body – alias to data.

  • content_type – Enforce specific content-type of provided data body. Otherwise, attempt to retrieve it from request headers. Inferred JSON content-type when json is employed, unless overridden explicitly.

  • headers – Set of headers to send the request. Header Content-Type is looked for if not overridden.

  • cookies – Cookies to provide to the request.

  • timeout – passed down to requests when using URL, otherwise ignored (unsupported).

  • retries – number of retry attempts in case the requested failed due to timeout (only when using URL).

  • allow_redirects – Passed down to requests when using URL, handled manually for same behaviour when using TestApp.

  • kwargs – any additional keywords that will be forwarded to the request call.

Returns:

response of the request

tests.utils.visual_repr(item: Any) str[source]
tests.utils.format_test_val_ref(val, ref, pre='Fail', msg=None)[source]
tests.utils.all_equal(iter_val, iter_ref, any_order=False)[source]
tests.utils.check_all_equal(iter_val: Collection[Any], iter_ref: Collection[Any] | cowbird.utils.NullType, msg: str | None = None, any_order: bool = False) None[source]
Parameters:
  • iter_val – tested values.

  • iter_ref – reference values.

  • msg – override message to display if failing test.

  • any_order – allow equal values to be provided in any order, otherwise order must match as well as values.

Raises:

AssertionError – If all values in iter_val are not equal to values within iter_ref. If any_order is False, also raises if equal items are not in the same order.

tests.utils.check_val_equal(val: Any, ref: Any | cowbird.utils.NullType, msg: str | None = None) None[source]
Raises:

AssertionError – if val is not equal to ref.

tests.utils.check_val_not_equal(val: Any, ref: Any | cowbird.utils.NullType, msg: str | None = None) None[source]
Raises:

AssertionError – if val is equal to ref.

tests.utils.check_val_is_in(val: Any, ref: Any | cowbird.utils.NullType, msg: str | None = None) None[source]
Raises:

AssertionError – if val is not in to ref.

tests.utils.check_val_not_in(val: Any, ref: Any | cowbird.utils.NullType, msg: str | None = None) None[source]
Raises:

AssertionError – if val is in to ref.

tests.utils.check_val_type(val: Any, ref: Type[Any] | cowbird.utils.NullType | Iterable[Type[Any]], msg: str | None = None) None[source]
Raises:

AssertionError – if val is not an instanced of ref.

tests.utils.check_raises(func: Callable[[], Any], exception_type: Type[Exception], msg: str | None = None) Exception[source]

Calls the callable and verifies that the specific exception was raised.

Raises:

AssertionError – on failing exception check or missing raised exception.

Returns:

raised exception of expected type if it was raised.

tests.utils.check_no_raise(func: Callable[[], Any], msg: str | None = None) Any[source]

Calls the callable and verifies that no exception was raised.

Raises:

AssertionError – on any raised exception.

tests.utils.check_response_basic_info(response: cowbird.typedefs.AnyResponseType, expected_code: int = 200, expected_type: str = CONTENT_TYPE_JSON, expected_method: str = 'GET', extra_message: str | None = None) cowbird.typedefs.JSON | str[source]

Validates basic Cowbird API response metadata. For UI pages, employ check_ui_response_basic_info() instead.

If the expected content-type is JSON, further validations are accomplished with specific metadata fields that are always expected in the response body. Otherwise, minimal validation of basic fields that can be validated regardless of content-type is done.

Parameters:
  • response – response to validate.

  • expected_code – status code to validate from the response.

  • expected_type – Content-Type to validate from the response.

  • expected_method – method ‘GET’, ‘POST’, etc. to validate from the response if an error.

  • extra_message – additional message to append to every specific test message if provided.

Returns:

json body of the response for convenience.

tests.utils.check_error_param_structure(body: cowbird.typedefs.JSON, param_value: Any | None = null, param_name: str | None = null, param_compare: Any | None = null, param_name_exists: bool = False, param_compare_exists: bool = False) None[source]

Validates error response param information based on different Cowbird version formats.

Parameters:
  • body – JSON body of the response to validate.

  • param_value – Expected ‘value’ of param the parameter. Contained field value not verified if null, only presence of the field.

  • param_name – Expected ‘name’ of param. Ignored for older Cowbird version that did not provide this information. Contained field value not verified if null and param_name_exists is True (only its presence). If provided, automatically implies param_name_exists=True. Skipped otherwise.

  • param_compare – Expected ‘compare’/’param_compare’ value (filed name according to version) Contained field value not verified if null and param_compare_exists is True (only its presence). If provided, automatically implies param_compare_exists=True. Skipped otherwise.

  • param_name_exists – verify that ‘name’ is in the body, not validating its value.

  • param_compare_exists – verify that ‘compare’/’param_compare’ is in the body, not validating its value.

Raises:

AssertionError – on any failing condition

tests.utils.check_path_permissions(path: str | os.PathLike, permissions: int, check_others_only: bool = False) None[source]

Checks if the path has the right permissions, by verifying the last digits of the octal permissions.

tests.utils.check_mock_has_calls(mocked_fct, calls)[source]

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.

2.2.0 (2023-11-16)

Bug Fixes
  • The FileSystem handler now creates the WPS outputs data folder if it doesn’t exist so that monitoring is setup properly.

  • User permissions are set explicitly after creating his datastore folder to make sure the user can create and modify files in it.

2.1.0 (2023-09-18)

Features / Changes
  • Add monitoring to the FileSystem handler to watch WPS outputs data.

  • Synchronize both public and user WPS outputs data to the workspace folder with hardlinks for user access.

  • Add resync endpoint /handlers/{handler_name}/resync to trigger a handler’s resync operations. Only the FileSystem handler is implemented for now, regenerating hardlinks associated to WPS outputs public data.

2.0.0 (2023-07-21)

  • Update Docker image to use python:3.10-alpine instead of python:3.7-alpine for latest security updates and performance improvements.

  • Update GitHub CI tests to include Python 3.9, 3.10 and 3.11, and use 3.10 by default for additional checks.

  • Update multiple package dependencies flagged by PyUp as well as any relevant code changes to support updated packages.

  • Move ports sections of example docker/docker-compose.*.yml files to the dev variant to reflect a realistic prod vs dev configuration scheme and allow ports overrides without merge of lists to avoid conflicts.

  • Add typing requirements and check-types[-only] targets to Makefile. To avoid breaking the CI on any minor typing issue, leave it as allow_failure: true for the moment. Further typing conversions and fixes can be applied gradually on a best-effort basis.

  • Covert type comments to type annotations.

  • Fix and improve Geoserver typings.

  • Drop Python 3.7 that reached end-of-life.

1.2.0 (2023-07-10)

Features / Changes
  • Add permission synchronization between Magpie’s permissions and Geoserver files permissions.

Bug Fixes
  • Fix bug where the monitors saved on the database and the internal monitors dictionary from the Monitoring class would be desynchronized, not always having the expected monitors, or having monitors that were not started properly.

  • Fix failing permissions synchronizer by adding service_type to the Magpie webhooks and ignoring permissions from resources not defined in the config (relates to Ouranosinc/Magpie#582).

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