<s> """<STR_LIT>""" <EOL> from werkzeug . wrappers import Request as RequestBase , Response as ResponseBase <EOL> from werkzeug . exceptions import BadRequest <EOL> from . debughelpers import attach_enctype_error_multidict <EOL> from . import json <EOL> from . globals import _request_ctx_stack <EOL> _missing = object ( ) <EOL> def _get_data ( req , cache ) : <EOL> getter = getattr ( req , '<STR_LIT>' , None ) <EOL> if getter is not None : <EOL> return getter ( cache = cache ) <EOL> return req . data <EOL> class Request ( RequestBase ) : <EOL> """<STR_LIT>""" <EOL> url_rule = None <EOL> view_args = None <EOL> routing_exception = None <EOL> _is_old_module = False <EOL> @ property <EOL> def max_content_length ( self ) : <EOL> """<STR_LIT>""" <EOL> ctx = _request_ctx_stack . top <EOL> if ctx is not None : <EOL> return ctx . app . config [ '<STR_LIT>' ] <EOL> @ property <EOL> def endpoint ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . url_rule is not None : <EOL> return self . url_rule . endpoint <EOL> @ property <EOL> def module ( self ) : <EOL> """<STR_LIT>""" <EOL> from warnings import warn <EOL> warn ( DeprecationWarning ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) , stacklevel = <NUM_LIT:2> ) <EOL> if self . _is_old_module : <EOL> return self . blueprint <EOL> @ property <EOL> def blueprint ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . url_rule and '<STR_LIT:.>' in self . url_rule . endpoint : <EOL> return self . url_rule . endpoint . rsplit ( '<STR_LIT:.>' , <NUM_LIT:1> ) [ <NUM_LIT:0> ] <EOL> @ property <EOL> def json ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . get_json ( ) <EOL> def get_json ( self , force = False , silent = False , cache = True ) : <EOL> """<STR_LIT>""" <EOL> rv = getattr ( self , '<STR_LIT>' , _missing ) <EOL> if rv is not _missing : <EOL> return rv <EOL> if self . mimetype != '<STR_LIT:application/json>' and not force : <EOL> return None <EOL> request_charset = self . mimetype_params . get ( '<STR_LIT>' ) <EOL> try : <EOL> data = _get_data ( self , cache ) <EOL> if request_charset is not None : <EOL> rv = json . loads ( data , encoding = request_charset ) <EOL> else : <EOL> rv = json . loads ( data ) <EOL> except ValueError as e : <EOL> if silent : <EOL> rv = None <EOL> else : <EOL> rv = self . on_json_loading_failed ( e ) <EOL> if cache : <EOL> self . _cached_json = rv <EOL> return rv <EOL> def on_json_loading_failed ( self , e ) : <EOL> """<STR_LIT>""" <EOL> raise BadRequest ( ) <EOL> def _load_form_data ( self ) : <EOL> RequestBase . _load_form_data ( self ) <EOL> ctx = _request_ctx_stack . top <EOL> if ctx is not None and ctx . app . debug and self . mimetype != '<STR_LIT>' and not self . files : <EOL> attach_enctype_error_multidict ( self ) <EOL> class Response ( ResponseBase ) : <EOL> """<STR_LIT>""" <EOL> default_mimetype = '<STR_LIT>' </s>
