コード例 #1
0
from clustaar.schemas.v1 import get_mapper


MAPPER = get_mapper()
コード例 #2
0
def mapper():
    return v1.get_mapper(factory=constructor)
コード例 #3
0
import falcon
from copy import copy
from lupin import constructor
from clustaar.schemas import v1
from .falcon import HTTPResponse, HTTPRequest
from . import EventsHandler
from .middlewares import BasicAuthenticationMiddleware, ValidateSignatureMiddleware, authenticators
from .routing import Router

MAPPER = v1.get_mapper(factory=constructor)


class Webhook(object):
    def __init__(self,
                 auth_username=None,
                 auth_password=None,
                 private_key=None,
                 middlewares=None):
        """
        Args:
            auth_username (str): HTTP authentication username
            auth_password (str): HTTP authentication password
            private_key (str): key used to validate signatures
            middlewares (list): list of falcon middlewares
        """
        middlewares = copy(middlewares) if middlewares else []
        if private_key:
            middlewares.append(ValidateSignatureMiddleware(private_key))
        if auth_username and auth_password:
            authenticator = authenticators.StaticAuthenticator(
                auth_username, auth_password)