ruạṛ
a [��f�{ � @ s� d Z ddlZddlZddlmZmZmZ ddlm Z ddl mZ ddlm Z mZ ddlZddlmZmZ ddlmZ ddlmZ G d d � d e�ZdS )zFalcon API class.� N)�api_helpers�DEFAULT_MEDIA_TYPE�routing)� HTTPError)� HTTPStatus)�Request�RequestOptions)�Response�ResponseOptions)�get_argnamesc @ s� e Zd ZdZeejejejej g�Z dZdZe eedddfdd�Zdd � Zed d� �Zdd � Zd%dd�Zd&dd�Zd'dd�Zdd� Zdd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd(d#d$�ZdS ))�APIa; This class is the main entry point into a Falcon-based app. Each API instance provides a callable WSGI interface and a routing engine. Keyword Arguments: media_type (str): Default media type to use as the value for the Content-Type header on responses (default 'application/json'). The ``falcon`` module provides a number of constants for common media types, such as ``falcon.MEDIA_MSGPACK``, ``falcon.MEDIA_YAML``, ``falcon.MEDIA_XML``, etc. middleware(object or list): Either a single object or a list of objects (instantiated classes) that implement the following middleware component interface:: class ExampleComponent(object): def process_request(self, req, resp): """Process the request before routing it. Args: req: Request object that will eventually be routed to an on_* responder method. resp: Response object that will be routed to the on_* responder. """ def process_resource(self, req, resp, resource, params): """Process the request and resource *after* routing. Note: This method is only called when the request matches a route to a resource. Args: req: Request object that will be passed to the routed responder. resp: Response object that will be passed to the responder. resource: Resource object to which the request was routed. May be None if no route was found for the request. params: A dict-like object representing any additional params derived from the route's URI template fields, that will be passed to the resource's responder method as keyword arguments. """ def process_response(self, req, resp, resource, req_succeeded) """Post-processing of the response (after routing). Args: req: Request object. resp: Response object. resource: Resource object to which the request was routed. May be None if no route was found for the request. req_succeeded: True if no exceptions were raised while the framework processed and routed the request; otherwise False. """ (See also: :ref:`Middleware <middleware>`) request_type (Request): ``Request``-like class to use instead of Falcon's default class. Among other things, this feature affords inheriting from ``falcon.request.Request`` in order to override the ``context_type`` class variable. (default ``falcon.request.Request``) response_type (Response): ``Response``-like class to use instead of Falcon's default class. (default ``falcon.response.Response``) router (object): An instance of a custom router to use in lieu of the default engine. (See also: :ref:`Custom Routers <routing_custom>`) independent_middleware (bool): Set to ``True`` if response middleware should be executed independently of whether or not request middleware raises an exception (default ``False``). Attributes: req_options: A set of behavioral options related to incoming requests. (See also: :py:class:`~.RequestOptions`) resp_options: A set of behavioral options related to outgoing responses. (See also: :py:class:`~.ResponseOptions`) router_options: Configuration options for the router. If a custom router is in use, and it does not expose any configurable options, referencing this attribute will raise an instance of ``AttributeError``. (See also: :ref:`CompiledRouterOptions <compiled_router_options>`) i ) � _request_type�_response_type�_error_handlers�_media_type�_router�_sinks�_serialize_error�req_options�resp_options�_middleware�_independent_middleware�_router_search�_static_routesNFc C s� g | _ || _g | _tj||d�| _|| _|p2t�� | _ t� | j �| _|| _|| _ g | _tj| _t� | _t� | _|| j_|| j_| �tj| j� | �tj| j� d S )N)�independent_middleware)r r r �helpers�prepare_middlewarer r r � DefaultRouterr �make_router_searchr r r r �default_serialize_errorr r r r r �default_media_type�add_error_handler�falconr �_http_error_handlerr �_http_status_handler)�self� media_type�request_type� response_type� middleware�routerr � r+ �n/sparta/input/_build_configuration/image_build+validate/lib/bmcenv/lib64/python3.9/site-packages/falcon/api.py�__init__� s&