6V=jddlmZddlmZddlZddlZddlZddl Z ddl m Z ddl m Z ddlmZddlmZddlmZddlZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlm Z ddlm!Z!ddlm"Z"ddl#m$Z$ddl%m&Z'ddl(m)Z)ddl*m+Z+ddl*mZ,ddl-m.Z.ddl-m/Z/ddl0m1Z1ddl0m2Z2ddl0m3Z3ddl0m4Z4ddl0m5Z5ddl0m6Z6dd l0m7Z7dd!l8m9Z9dd"l8m:Z:dd#l8m;Z;dd$l8mZ>dd&l?m@Z@dd'lAmBZBdd(lAmCZCdd)lDmEZEdd*lDmFZFdd+lDmGZGdd,lDmHZHdd-lDmIZIdd.lJmKZKdd/lLmMZMddlLm&Z&ejNrdd0lOmPZPdd1lOmQZQdd2lRmSZSdd3lRmTZTdd4lmUZUejVd5e,jW6ZXejVd7e,jY6ZZejVd8e,j[6Z\ejVd9e,j]6Z^ejVd:e,j_6Z`dBd?ZaGd@dAe>ZbdS)C) annotationsN) timedelta)iscoroutinefunction)chain) TracebackType)quote)Headers) ImmutableDict)BadRequestKeyError) HTTPException)InternalServerError) BuildError) MapAdapter)RequestRedirect)RoutingException)Rule)is_running_from_reloader)Response)get_host)cli)typing AppContextRequestContext)_cv_app) _cv_request) current_app)g)request) request_ctx)session)get_debug_flag)get_flashed_messages)get_load_dotenv)send_from_directory)App) _sentinel)SecureCookieSessionInterface)SessionInterface)appcontext_tearing_down)got_request_exception)request_finished)request_started)request_tearing_down) Environment)Request) StartResponse)WSGIEnvironment FlaskClientFlaskCliRunner) HeadersValueT_shell_context_processor)bound T_teardownT_template_filterT_template_globalT_template_testvaluetimedelta | int | Nonereturntimedelta | NonecT|t|tr|St|S)N)seconds) isinstancer)r@s 7C:\PYTHON\_runtimes\venv\Lib\site-packages\flask/app.py_make_timedeltarHJs+ } 5)44} U # # ##cVeZdZUdZeiddddddddddd ed d dd dddddddddddddddddddddddddddddddd ZeZde d <e Z d!e d"<e Z d#e d$< ddfd5 Zdd9Zdd;Z dddAZ dddCZddEZddIZddLZddPZddQZ dddYZddd]Zdd_ZddcZddeZddfZddiZddkZddlZ dddpZ!ddqZ"ddtZ#ddvZ$dddddwdd~Z%ddZ&ddZ'ddZ(e)fddZ*e)fddZ+ddZ,ddZ-ddZ.ddZ/ddZ0xZ1S)FlaskaThe flask object implements a WSGI application and acts as the central object. It is passed the name of the module or package of the application. Once it is created it will act as a central registry for the view functions, the URL rules, template configuration and much more. The name of the package is used to resolve resources from inside the package or the folder the module is contained in depending on if the package parameter resolves to an actual python package (a folder with an :file:`__init__.py` file inside) or a standard module (just a ``.py`` file). For more information about resource loading, see :func:`open_resource`. Usually you create a :class:`Flask` instance in your main module or in the :file:`__init__.py` file of your package like this:: from flask import Flask app = Flask(__name__) .. admonition:: About the First Parameter The idea of the first parameter is to give Flask an idea of what belongs to your application. This name is used to find resources on the filesystem, can be used by extensions to improve debugging information and a lot more. So it's important what you provide there. If you are using a single module, `__name__` is always the correct value. If you however are using a package, it's usually recommended to hardcode the name of your package there. For example if your application is defined in :file:`yourapplication/app.py` you should create it with one of the two versions below:: app = Flask('yourapplication') app = Flask(__name__.split('.')[0]) Why is that? The application will work even with `__name__`, thanks to how resources are looked up. However it will make debugging more painful. Certain extensions can make assumptions based on the import name of your application. For example the Flask-SQLAlchemy extension will look for the code in your application that triggered an SQL query in debug mode. If the import name is not properly set up, that debugging information is lost. (For example it would only pick up SQL queries in `yourapplication.app` and not `yourapplication.views.frontend`) .. versionadded:: 0.7 The `static_url_path`, `static_folder`, and `template_folder` parameters were added. .. versionadded:: 0.8 The `instance_path` and `instance_relative_config` parameters were added. .. versionadded:: 0.11 The `root_path` parameter was added. .. versionadded:: 1.0 The ``host_matching`` and ``static_host`` parameters were added. .. versionadded:: 1.0 The ``subdomain_matching`` parameter was added. Subdomain matching needs to be enabled manually now. Setting :data:`SERVER_NAME` does not implicitly enable it. :param import_name: the name of the application package :param static_url_path: can be used to specify a different path for the static files on the web. Defaults to the name of the `static_folder` folder. :param static_folder: The folder with static files that is served at ``static_url_path``. Relative to the application ``root_path`` or an absolute path. Defaults to ``'static'``. :param static_host: the host to use when adding the static route. Defaults to None. Required when using ``host_matching=True`` with a ``static_folder`` configured. :param host_matching: set ``url_map.host_matching`` attribute. Defaults to False. :param subdomain_matching: consider the subdomain relative to :data:`SERVER_NAME` when matching routes. Defaults to False. :param template_folder: the folder that contains the templates that should be used by the application. Defaults to ``'templates'`` folder in the root path of the application. :param instance_path: An alternative instance path for the application. By default the folder ``'instance'`` next to the package or module is assumed to be the instance path. :param instance_relative_config: if set to ``True`` relative filenames for loading the config are assumed to be relative to the instance path instead of the application root. :param root_path: The path to the root of the application files. This should only be set manually when it can't be detected automatically, such as for namespace packages. DEBUGNTESTINGFPROPAGATE_EXCEPTIONS SECRET_KEYSECRET_KEY_FALLBACKSPERMANENT_SESSION_LIFETIME)daysUSE_X_SENDFILE TRUSTED_HOSTS SERVER_NAMEAPPLICATION_ROOT/SESSION_COOKIE_NAMEr#SESSION_COOKIE_DOMAINSESSION_COOKIE_PATHSESSION_COOKIE_HTTPONLYTSESSION_COOKIE_SECURESESSION_COOKIE_PARTITIONEDSESSION_COOKIE_SAMESITEi ihttpi) SESSION_REFRESH_EACH_REQUESTMAX_CONTENT_LENGTHMAX_FORM_MEMORY_SIZEMAX_FORM_PARTSSEND_FILE_MAX_AGE_DEFAULTTRAP_BAD_REQUEST_ERRORSTRAP_HTTP_EXCEPTIONSEXPLAIN_TEMPLATE_LOADINGPREFERRED_URL_SCHEMETEMPLATES_AUTO_RELOADMAX_COOKIE_SIZEPROVIDE_AUTOMATIC_OPTIONSz type[Request] request_classztype[Response]response_classr+session_interfacestatic templates import_namestrstatic_url_path str | None static_folderstr | os.PathLike[str] | None static_host host_matchingboolsubdomain_matchingtemplate_folder instance_pathinstance_relative_config root_pathc n t||||||||| |  tj|_|j|j_|jrWt ||ks Jdtj| | |j dd| fddSdS)N) rrrtrvrxryr{r|r}r~rz-Invalid static_host/host_matching combinationz/rpc.jdi|S)N)send_static_file)kwself_refs rGz Flask.__init__..s!'Bxxzz'B'H'HR'H'HrI)endpointhost view_func) super__init__rAppGroupnamehas_static_folderrzweakrefref add_url_rulert) selfrrrtrvrxryr{r|r}r~rr __class__s @rGrzFlask.__init__s #+'#'1+'%=  "<>>    !  $$ 555?655 {4((H   '999! HHHH        rIfilenamerB int | Nonectjd}|dSt|tr!t |S|S)anUsed by :func:`send_file` to determine the ``max_age`` cache value for a given file path if it wasn't passed. By default, this returns :data:`SEND_FILE_MAX_AGE_DEFAULT` from the configuration of :data:`~flask.current_app`. This defaults to ``None``, which tells the browser to use conditional requests instead of a timed cache, which is usually preferable. Note this is a duplicate of the same method in the Flask class. .. versionchanged:: 2.0 The default configuration is ``None`` instead of 12 hours. .. versionadded:: 0.9 reN)rconfigrFrint total_seconds)rrr@s rGget_send_file_max_agezFlask.get_send_file_max_agesM""#>? =4 eY ' ' .u**,,-- - rIrc|jstd||}tt jt |j||S)aAThe view function used to serve files from :attr:`static_folder`. A route is automatically registered for this view at :attr:`static_url_path` if :attr:`static_folder` is set. Note this is a duplicate of the same method in the Flask class. .. versionadded:: 0.5 z2'static_folder' must be set to serve static_files.)max_age)r RuntimeErrorrr'tcastrsrv)rrrs rGrzFlask.send_static_file4sa% USTT T,,X66" F3* + +Xw    rIrbresourcemodeencodingt.IO[t.AnyStr]c|dvrtdtj|j|}|dkrt ||St |||S)a Open a resource file relative to :attr:`root_path` for reading. For example, if the file ``schema.sql`` is next to the file ``app.py`` where the ``Flask`` app is defined, it can be opened with: .. code-block:: python with app.open_resource("schema.sql") as f: conn.executescript(f.read()) :param resource: Path to the resource relative to :attr:`root_path`. :param mode: Open the file in this mode. Only reading is supported, valid values are ``"r"`` (or ``"rt"``) and ``"rb"``. :param encoding: Open the file with this encoding when opening in text mode. This is ignored when opening in binary mode. .. versionchanged:: 3.1 Added the ``encoding`` parameter. >rrrtz)Resources can only be opened for reading.rr) ValueErrorospathjoinropenrrrrrs rG open_resourcezFlask.open_resourceJsd. ( ( (HII Iw||DNH55 4<<d## #D$2222rIutf-8ctj|j|}d|vrt ||St |||S)a(Open a resource file relative to the application's instance folder :attr:`instance_path`. Unlike :meth:`open_resource`, files in the instance folder can be opened for writing. :param resource: Path to the resource relative to :attr:`instance_path`. :param mode: Open the file in this mode. :param encoding: Open the file with this encoding when opening in text mode. This is ignored when opening in binary mode. .. versionchanged:: 3.1 Added the ``encoding`` parameter. br)rrrr}rrs rGopen_instance_resourcezFlask.open_instance_resourceksJw||D.99 $;;d## #D$2222rIr1cHt|j}d|vr |j|d<d|vr|jd}||j}||d<|j|fi|}|j|jt|jttt|j j|jd<|S)aCreate the Jinja environment based on :attr:`jinja_options` and the various Jinja-related methods of the app. Changing :attr:`jinja_options` after this will have no effect. Also adds Flask-related globals and filters to the environment. .. versionchanged:: 0.11 ``Environment.auto_reload`` set in accordance with ``TEMPLATES_AUTO_RELOAD`` configuration option. .. versionadded:: 0.5 autoescape auto_reloadrjN)url_forr%rr!r#r zjson.dumps_function)dict jinja_optionsselect_jinja_autoescaperdebugjinja_environmentglobalsupdaterr%r!r#r jsondumpspolicies)roptionsrrvs rGcreate_jinja_environmentzFlask.create_jinja_environmentst)** w & &$($@GL !  ' '+&=>K""j %0GM " #T #D 4 4G 4 4 L!5;  .2Y_ )* rIr!Request | NoneMapAdapter | Nonec||jdx}||_t|j|j|_d}|jd}|jjrd}n|js|jjpd}|j |j||S|jd>|j |jd|jd|jdSdS) aCreates a URL adapter for the given request. The URL adapter is created at a point where the request context is not yet set up so the request is passed explicitly. .. versionchanged:: 3.1 If :data:`SERVER_NAME` is set, it does not restrict requests to only that domain, for both ``subdomain_matching`` and ``host_matching``. .. versionchanged:: 1.0 :data:`SERVER_NAME` no longer implicitly enables subdomain matching. Use :attr:`subdomain_matching` instead. .. versionchanged:: 0.9 This can be called outside a request when the URL adapter is created for an application context. .. versionadded:: 0.6 NrUrV) server_name subdomainrWri) script_name url_scheme) r trusted_hostsrenvironrurl_mapryr{default_subdomainbind_to_environbind)rr!rrrs rGcreate_url_adapterzFlask.create_url_adapters(  !%_!== J(5%$GOW5JKKGLI+m4K|) A# , A!L:@b <//[I0  ;} % 1<$$ M* K(:;;'=>%  trIr2 t.NoReturnc|jr1t|jtr|jjdvs |jdvr|jddlm}||)aIntercept routing exceptions and possibly do something else. In debug mode, intercept a routing redirect and replace it with an error if the body will be discarded. With modern Werkzeug this shouldn't occur, since it now uses a 308 status which tells the browser to resend the method and body. .. versionchanged:: 2.1 Don't intercept 307 and 308 redirects. :meta private: :internal: >34>GETHEADOPTIONSr)FormDataRoutingRedirect)rrFrouting_exceptionrcodemethod debughelpersr)rr!rs rGraise_routing_exceptionzFlask.raise_routing_exceptionsp"  ,g7II ,(-;;~!;;;+ +999999%%g...rIcontextdict[str, t.Any]NonecTd}tr't|ttj}|}|D]K}||jvr@|j|D]2}|||3L||dS)aUpdate the template context with some commonly used variables. This injects request, session, config and g into the template context as well as everything template context processors want to inject. Note that the as of Flask 0.6, the original values in the context will not be overridden if a context processor decides to return a value with the same key. :param context: the context as a dictionary that is updated in place to add extra variables. NN)r!rreversed blueprintscopytemplate_context_processorsr ensure_sync)rrnamesorig_ctxrfuncs rGupdate_template_contextzFlask.update_template_contexts)0  ?%'*>E<<>> = =Dt777 >. / /6 9 9+--  +  F ; ' ' . O    **+--   eDJkoom44   '  ="-"7"7"<"< GQ # #"  4199t99DD  w<4:666>4:666:t,,, tz49555////// , Jqvc4(($ @ @ @ @ @ ',D # # #eD # + + + +s #F// F8 use_cookieskwargsr6c B|j}|ddlm}|||jfd|i|S)aCreates a test client for this application. For information about unit testing head over to :doc:`/testing`. Note that if you are testing for assertions or exceptions in your application code, you must set ``app.testing = True`` in order for the exceptions to propagate to the test client. Otherwise, the exception will be handled by the application (not visible to the test client) and the only indication of an AssertionError or other exception will be a 500 status code response to the test client. See the :attr:`testing` attribute. For example:: app.testing = True client = app.test_client() The test client can be used in a ``with`` block to defer the closing down of the context until the end of the ``with`` block. This is useful if you want to access the context locals for testing:: with app.test_client() as c: rv = c.get('/?vodka=42') assert request.args['vodka'] == '42' Additionally, you may pass optional keyword arguments that will then be passed to the application's :attr:`test_client_class` constructor. For example:: from flask.testing import FlaskClient class CustomClient(FlaskClient): def __init__(self, *args, **kwargs): self._authentication = kwargs.pop("authentication") super(CustomClient,self).__init__( *args, **kwargs) app.test_client_class = CustomClient client = app.test_client(authentication='Basic ....') See :class:`~flask.testing.FlaskClient` for more information. .. versionchanged:: 0.4 added support for ``with`` block usage for the client. .. versionadded:: 0.7 The `use_cookies` parameter was added as well as the ability to override the client to be used by setting the :attr:`test_client_class` attribute. .. versionchanged:: 0.11 Added `**kwargs` to support passing additional keyword arguments to the constructor of :attr:`test_client_class`. Nrr5r)test_client_classtestingr6rn)rrrclss rG test_clientzFlask.test_clientsUf$ ; 3 3 3 3 3 3s $%  3> BH   rIr8c 2|j}|ddlm}||fi|S)a-Create a CLI runner for testing CLI commands. See :ref:`testing-cli`. Returns an instance of :attr:`test_cli_runner_class`, by default :class:`~flask.testing.FlaskCliRunner`. The Flask app object is passed as the first argument. .. versionadded:: 1.0 Nrr7)test_cli_runner_classrr8)rrrs rGtest_cli_runnerzFlask.test_cli_runners;( ; 6 6 6 6 6 6s4""6"""rIer &HTTPException | ft.ResponseReturnValuec|j|St|tr|S||tj}||S|||S)acHandles an HTTP exception. By default this will invoke the registered error handlers and fall back to returning the exception as response. .. versionchanged:: 1.0.3 ``RoutingException``, used internally for actions such as slash redirects during routing, is not passed to error handlers. .. versionchanged:: 1.0 Exceptions are looked up by code *and* by MRO, so ``HTTPException`` subclasses can be handled with a catch-all handler for the base ``HTTPException``. .. versionadded:: 0.3 )rrFr_find_error_handlerr!rrrrhandlers rGhandle_http_exceptionzFlask.handle_http_exceptionsj* 6>H a) * * H**1g.@AA ?H(t((+++rI Exceptioncbt|tr|js |jdrd|_t|t r*||s||S||tj }|| ||S)a>This method is called whenever an exception occurs that should be handled. A special case is :class:`~werkzeug .exceptions.HTTPException` which is forwarded to the :meth:`handle_http_exception` method. This function will either return a response value or reraise the exception with the same traceback. .. versionchanged:: 1.0 Key errors raised from request data like ``form`` show the bad key in debug mode rather than a generic bad request message. .. versionadded:: 0.7 rfT) rFr rrshow_exceptionr trap_http_exceptionrrr!rrrs rGhandle_user_exceptionzFlask.handle_user_exception s" a+ , , $ J $+&?@ $ $A  a ' ' 10H0H0K0K 1--a00 0**1g.@AA ? (t((+++rIctj}tj||j||jd}||jp|j}|r |d|ur|||t|}| |tj }||||}| |dS)aHandle an exception that did not have an error handler associated with it, or that was raised from an error handler. This always causes a 500 ``InternalServerError``. Always sends the :data:`got_request_exception` signal. If :data:`PROPAGATE_EXCEPTIONS` is ``True``, such as in debug mode, the error will be re-raised so that the debugger can display it. Otherwise, the original exception is logged, and an :exc:`~werkzeug.exceptions.InternalServerError` is returned. If an error handler is registered for ``InternalServerError`` or ``500``, it will be used. For consistency, the handler will always receive the ``InternalServerError``. The original unhandled exception is available as ``e.original_exception``. .. versionchanged:: 1.1.0 Always passes the ``InternalServerError`` instance to the handler, setting ``original_exception`` to the unhandled error. .. versionchanged:: 1.1.0 ``after_request`` functions and other finalization is done even for the default 500 response when there is no handler. .. versionadded:: 0.3 )_async_wrapper exceptionrNNr)original_exceptionT)from_error_handler)sysexc_infor-sendrrrr log_exceptionr rr!rfinalize_request)rrr+ propagate server_errorrs rGhandle_exceptionzFlask.handle_exception+s8<>>"48HTUVVVVK 67   2 I  {aG 8$$$*a@@@ **<9KLL  44++G44\BBL$$\d$KKKrIr+Ctuple[type, BaseException, TracebackType] | tuple[None, None, None]ct|jdtjdtjd|dS)a Logs an exception. This is called by :meth:`handle_exception` if debugging is disabled and right before the handler is called. The default implementation logs the exception as error on the :attr:`logger`. .. versionadded:: 0.8 z Exception on z [])r+N)loggererrorr!rr)rr+s rGr-zFlask.log_exception`sI  =GL = =GN = = =      rIft.ResponseReturnValuec$tj}|j|||j}t |ddr|jdkr|S|j}| |j |j di|S)aDoes the request dispatching. Matches the URL and returns the return value of the view or error handler. This does not have to be a response object. In order to convert the return value to a proper response object, call :func:`make_response`. .. versionchanged:: 0.7 This no longer does the exception handling, this code was moved to the new :meth:`full_dispatch_request`. Nprovide_automatic_optionsFrr) r"r!rrurl_rulegetattrrmake_default_options_response view_argsrview_functionsr)rreqruler=s rGdispatch_requestzFlask.dispatch_requestos!  ,  ( ( - - -\ D5u = = 8 i''5577 7&)m Ct 3DM BCCPPiPPPrIc d|_ tj||j|}||}n,#t $r}||}Yd}~nd}~wwxYw||S)zDispatches the request and on top of that performs request pre and postprocessing as well as HTTP exception catching and error handling. .. versionadded:: 0.7 T)r&N) r r/r,rpreprocess_requestrAr r$r.)rrrs rGfull_dispatch_requestzFlask.full_dispatch_requests#' /  d6F G G G G((**Bz**,, / / /++A..BBBBBB /$$R(((sAA A8A33A8r&ft.ResponseReturnValue | HTTPExceptionr)c||} ||}tj||j|n-#t $r |s|jdYnwxYw|S)a)Given the return value from a view function this finalizes the request by converting it into a response and invoking the postprocessing functions. This is invoked for both normal request dispatching as well as error handlers. Because this means that it might be called as a result of a failure a special safe mode is available which can be enabled with the `from_error_handler` flag. If enabled, failures in response processing will be logged and otherwise ignored. :internal: )r&responsez?Request finalizing failed with an error while handling an error) make_responseprocess_responser.r,rr r5r')rrr)rGs rGr.zFlask.finalize_requests"%%b)) ,,X66H  !T%5        %  K ! !Q       s1A 'A32A3ctj}|}|}|j||S)zThis method is called to create the default ``OPTIONS`` response. This can be changed through subclassing to change the default behavior of ``OPTIONS`` responses. .. versionadded:: 0.7 )r" url_adapterallowed_methodsrnallowr)radaptermethodsrs rGr<z#Flask.make_default_options_responsesG)))++  " "     rIrt.Callable[..., t.Any]cNt|r||S|S)a)Ensure that the function is synchronous for WSGI workers. Plain ``def`` functions are returned as-is. ``async def`` functions are wrapped to run and wait for the response. Override this method to change how the app runs async views. .. versionadded:: 2.0 )r async_to_sync)rrs rGrzFlask.ensure_syncs- t $ $ ,%%d++ + rI1t.Callable[..., t.Coroutine[t.Any, t.Any, t.Any]]cd ddlm}n#t$rtddwxYw||S)a1Return a sync function that will run the coroutine function. .. code-block:: python result = app.async_to_sync(func)(*args, **kwargs) Override this method to change how the app converts async code to be synchronously callable. .. versionadded:: 2.0 r)rRzAInstall Flask with the 'async' extra in order to use async views.N) asgiref.syncrR ImportErrorr)rrasgiref_async_to_syncs rGrRzFlask.async_to_syncsb  K K K K K K K   S   %$T***s $_anchor_method_scheme _externalrrYrZr[r\valuesc tjd}|;|j}|jj} |dddkr| | |}n |dd}||du}nHt jd} | | j}n|d}|td|d}||std| || | |||||} nG#t$r:} | ||||| | ||cYd} ~ Sd} ~ wwxYw|t|d }| d |} | S) a Generate a URL to the given endpoint with the given values. This is called by :func:`flask.url_for`, and can be called directly as well. An *endpoint* is the name of a URL rule, usually added with :meth:`@app.route() `, and usually the same name as the view function. A route defined in a :class:`~flask.Blueprint` will prepend the blueprint's name separated by a ``.`` to the endpoint. In some cases, such as email messages, you want URLs to include the scheme and domain, like ``https://example.com/hello``. When not in an active request, URLs will be external by default, but this requires setting :data:`SERVER_NAME` so Flask knows what domain to use. :data:`APPLICATION_ROOT` and :data:`PREFERRED_URL_SCHEME` should also be configured as needed. This config is only used when not in an active request. Functions can be decorated with :meth:`url_defaults` to modify keyword arguments before the URL is built. If building fails for some reason, such as an unknown endpoint or incorrect values, the app's :meth:`handle_url_build_error` method is called. If that returns a string, that is returned, otherwise a :exc:`~werkzeug.routing.BuildError` is raised. :param endpoint: The endpoint name associated with the URL to generate. If this starts with a ``.``, the current blueprint name (if any) will be used. :param _anchor: If given, append this as ``#anchor`` to the URL. :param _method: If given, generate the URL associated with this method for the endpoint. :param _scheme: If given, the URL will have this scheme if it is external. :param _external: If given, prefer the URL to be internal (False) or require it to be external (True). External URLs include the scheme and domain. When not in an active request, URLs are external by default. :param values: Values to use for the variable parts of the URL rule. Unknown keys are appended as query string arguments, like ``?a=b&c=d``. .. versionadded:: 2.2 Moved from ``flask.url_for``, which calls this method. Nr.zUnable to build URLs outside an active request without 'SERVER_NAME' configured. Also configure 'APPLICATION_ROOT' and 'PREFERRED_URL_SCHEME' as needed.Tz4When specifying '_scheme', '_external' must be True.)rrforce_externalrXz%!#$&'()*+,/:;=?@)safe#)rrrKr! blueprintrrrrinject_url_defaultsbuildrrhandle_url_build_error _url_quote) rrrYrZr[r\r]req_ctxrKblueprint_nameapp_ctxrr6s rGrz Flask.url_forsr/$''  !-K$_6N|s""!-"0<(<`, which may be delayed during testing to maintain access to resources. :param exc: An unhandled exception raised while dispatching the request. Detected from the current exception information if not passed. Passed to each teardown function. .. versionchanged:: 0.9 Added the ``exc`` argument. rrr&rN) r)r*r+rr!rteardown_request_funcsrrr0r,)rrrrs rGdo_teardown_requestzFlask.do_teardown_request.s0 )  ,..#C',g66 0 0Dt222$T%@%FGG00D*D$$T**3////!$t7GSQQQQQQrIc|turtjd}t|jD] }|||!t j||j|dS)aCalled right before the application context is popped. When handling a request, the application context is popped after the request context. See :meth:`do_teardown_request`. This calls all functions decorated with :meth:`teardown_appcontext`. Then the :data:`appcontext_tearing_down` signal is sent. This is called by :meth:`AppContext.pop() `. .. versionadded:: 0.9 rrN)r)r*r+rteardown_appcontext_funcsrr,r,)rrrs rGdo_teardown_appcontextzFlask.do_teardown_appcontextPs|$ )  ,..#CT;<< ( (D "D  T " "3 ' ' ' '$T$:JPSTTTTTTrIrc t|S)aFCreate an :class:`~flask.ctx.AppContext`. Use as a ``with`` block to push the context, which will make :data:`current_app` point at this application. An application context is automatically pushed by :meth:`RequestContext.push() ` when handling a request, and when running a CLI command. Use this to manually create a context outside of these situations. :: with app.app_context(): init_db() See :doc:`/appcontext`. .. versionadded:: 0.9 r)rs rG app_contextzFlask.app_contextjs&$rIrr4rc"t||S)a$Create a :class:`~flask.ctx.RequestContext` representing a WSGI environment. Use a ``with`` block to push the context, which will make :data:`request` point at this request. See :doc:`/reqcontext`. Typically you should not call this from your own code. A request context is automatically pushed by the :meth:`wsgi_app` when handling a request. Use :meth:`test_request_context` to create an environment and context instead of this method. :param environ: a WSGI environment r)rrs rGrequest_contextzFlask.request_contextsdG,,,rIargscddlm}||g|Ri|} |||S#|wxYw)aCreate a :class:`~flask.ctx.RequestContext` for a WSGI environment created from the given values. This is mostly useful during testing, where you may want to run a function that uses request data without dispatching a full request. See :doc:`/reqcontext`. Use a ``with`` block to push the context, which will make :data:`request` point at the request for the created environment. :: with app.test_request_context(...): generate_report() When using the shell, it may be easier to push and pop the context manually to avoid indentation. :: ctx = app.test_request_context(...) ctx.push() ... ctx.pop() Takes the same arguments as Werkzeug's :class:`~werkzeug.test.EnvironBuilder`, with some defaults from the application. See the linked Werkzeug docs for most of the available arguments. Flask-specific behavior is listed here. :param path: URL path being requested. :param base_url: Base URL where the app is being served, which ``path`` is relative to. If not given, built from :data:`PREFERRED_URL_SCHEME`, ``subdomain``, :data:`SERVER_NAME`, and :data:`APPLICATION_ROOT`. :param subdomain: Subdomain name to append to :data:`SERVER_NAME`. :param url_scheme: Scheme to use instead of :data:`PREFERRED_URL_SCHEME`. :param data: The request body, either as a string or a dict of form keys and values. :param json: If given, this is serialized as JSON and passed as ``data``. Also defaults ``content_type`` to ``application/json``. :param args: other positional arguments passed to :class:`~werkzeug.test.EnvironBuilder`. :param kwargs: other keyword arguments passed to :class:`~werkzeug.test.EnvironBuilder`. r)EnvironBuilder)rrr get_environclose)rrrrbuilders rGtest_request_contextzFlask.test_request_contextsy^ ,+++++ .777777 ''(;(;(=(=>> MMOOOOGMMOOOOs &AA%start_responser3cabc.Iterable[bytes]c||}d} ||}nH#t$r!}|}||}Yd}~n"d}~wt jd}xYw|||d|vrD|dtj|dtj|| |rd}| |S#d|vrD|dtj|dtj|| |rd}| |wxYw)aThe actual WSGI application. This is not implemented in :meth:`__call__` so that middlewares can be applied without losing a reference to the app object. Instead of doing this:: app = MyMiddleware(app) It's a better idea to do this instead:: app.wsgi_app = MyMiddleware(app.wsgi_app) Then you still have the original application object around and can continue to call methods on it. .. versionchanged:: 0.7 Teardown events for the request and app contexts are called even if an unhandled error occurs. Other events may not be called depending on when an error occurs during dispatch. See :ref:`callbacks-and-errors`. :param environ: A WSGI environment. :param start_response: A callable accepting a status code, a list of headers, and an optional exception context to start the response. Nrzwerkzeug.debug.preserve_context) rpushrDr r1r*r+rrrshould_ignore_errorpop)rrrrr6rGrs rGwsgi_appzFlask.wsgi_apps6""7++&*   5577 4 4 40033  q)8G^440G;;:9:7;==III:9:;?;L;LMMM T%=%=e%D%D  GGENNNN1G;;:9:7;==III:9:;?;L;LMMM T%=%=e%D%D  GGENNNNs0(AD  B A)$D )BD A8Fc.|||S)zThe WSGI server calls the Flask application object as the WSGI application. This calls :meth:`wsgi_app`, which can be wrapped to apply middleware. )r)rrrs rG__call__zFlask.__call__s}}Wn555rI) NrpNFFrqNFN)rrrsrtrurvrwrxruryrzr{rzr|rwr}rur~rzrru)rrurBr)rrsrBr)rN)rrsrrsrrurBr)rr)rBr1)r!rrBr)r!r2rBr)rrrBr)rBr)NNNT) rrurrrrrrzrrrBr)T)rrzrrrBr6)rrrBr8)rr rBr)rr rBr)rr rBr)r+r2rBr)rBr7)rBr)F)rrEr)rzrBr)rrPrBrP)rrSrBrP)rrsrYrurZrur[rur\rr]rrBrs)rr7rBr)rBr)rGrrBr)rrrBr)rBr)rr4rBr)rrrrrBr)rr4rr3rBr)2r| __module__ __qualname____doc__r rdefault_configr2rm__annotations__rrnr*rorrrrrrrrrrrrrrr$r1r-rArDr.r<rrRrrHrCrIr)rrrrrrr __classcell__)rs@rGrKrKQs^^@#] T u  #D  $  #D  )))*<*<*<   e  T  4    "9  $T  "4  &t  $U )%! " &t# $-1"&$+#)-'+$)(-$*%)#)-;     NH$+M****&.N---- +G*F*H*HHHHH '+7?"&##(9D$(). $5555555n6    .GK33333DGN33333,&&&&P3333j////8!!!!8     ! y,y,y,y,y,v8 8 8 8 8 t####"!,!,!,!,F,,,,@3L3L3L3Lj     QQQQ2))))*$)>        ++++8#""!%|||||||LLLL\6<%. R R R R RH%.UUUUU4    *---- 6666p0000d66666666rIrK)r@rArBrC)c __future__rcollections.abcabcrvrr*rrrdatetimerinspectr itertoolsrtypesr urllib.parserrgrwerkzeug.datastructuresr r werkzeug.exceptionsr r r werkzeug.routingrrrrrr rwerkzeug.wrappersrrx werkzeug.wsgirrrftrrrrrrrr r!r"r#helpersr$r%r&r' sansio.appr(sansio.scaffoldr)sessionsr*r+signalsr,r-r.r/r0 templatingr1wrappersr2 TYPE_CHECKING_typeshed.wsgir3r4rr6r8r9TypeVarShellContextProcessorCallabler:TeardownCallabler<TemplateFilterCallabler=TemplateGlobalCallabler>TemplateTestCallabler?rHrKrrIrGrs"""""" '''''',,,,,, ++++++111111222222------333333'''''''''''',,,,,,------!!!!!!555555666666""""""  ######))))))$$$$$$((((((&&&&&&222222&&&&&&,,,,,,******%%%%%%$$$$$$))))))######?%,,,,,,......$$$$$$''''''$$$$$$%AIr'GQY|2+> ? ? ? AI19RSSSAI19RSSS!)-R5LMMM$$$$o6o6o6o6o6Co6o6o6o6o6rI