/usr/local/lib/python3.6/site-packages/werkzeug/wrappers/__pycache__
NameSizeModeActions
accept.cpython-36.pyc7600644editdlrm
auth.cpython-36.pyc13080644editdlrm
base_request.cpython-36.pyc17010644editdlrm
base_response.cpython-36.pyc17120644editdlrm
common_descriptors.cpython-36.pyc13850644editdlrm
cors.cpython-36.pyc12930644editdlrm
etag.cpython-36.pyc12930644editdlrm
json.cpython-36.pyc7520644editdlrm
request.cpython-36.pyc210660644editdlrm
response.cpython-36.pyc296130644editdlrm
user_agent.cpython-36.pyc7730644editdlrm
__init__.cpython-36.pyc8660644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/werkzeug/wrappers/__pycache__/request.cpython-36.pyc (21066B)
3 _TBg`@sDddlZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl m Z ddl m Z dd l mZdd l mZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZejrddlZ ddl!m"Z"ddl!m#Z#GdddeZGdddZ$Gddde$eZ%dS)N)BytesIO)_wsgi_decoding_dance)CombinedMultiDict)EnvironHeaders) FileStorage)ImmutableMultiDict)iter_multi_items) MultiDict)default_stream_factory)FormDataParser)Request)cached_property)environ_property) _get_server)get_input_stream) BadRequest)WSGIApplication)WSGIEnvironmentcseZdZUdZdZejedZejee Z ej e  dZ eje  de dNde e ddfdd Zeejejdd d d Zeejdgd fd d ddZdOejeejeejeejeejedddZee dddZe dddZddddZejedddZddddZddddZ ddd d!Z!e"ejedd"d#Z#e$ejed$d%d&Z%e"edd'd(Z&e'j(dPe d)e ed*d+d,Z)e'j(dQe d.e ed*d/d,Z)dRe e e ej*eefd*d0d,Z)e"d1dd2d3Z+e"d4dd5d6Z,e"d7dd8d9Z-eedd:d;Z.e"eddd?d&Z0e$e d@dAd&Z1e$e dBdCd&Z2e$e dDdEd&Z3e4Z5eejejddFdGZ4e6e6fZ7ej8ejejf7dSe e e ejejdHdIdJZ9e:ejdKdLdMZ;Zr;r=r2r3 applications  z(Request.application..applicationr) exceptionsr> functoolswrapstcast)r;r=rCr2)r>r;r=r3rCs  zRequest.application)total_content_length content_typefilenamecontent_lengthrcCst||||dS)aCalled to get a stream for the file upload. This must provide a file-like class with `read()`, `readline()` and `seek()` methods that is both writeable and readable. The default implementation returns a temporary file if the total content length is higher than 500KB. Because many browsers do not provide a content length for the files only the total content length matters. :param total_content_length: the total content length of all the data in the request combined. This value is guaranteed to be there. :param content_type: the mimetype of the uploaded file. :param filename: the filename of the uploaded file. May be `None`. :param content_length: the length of this file. This value is usually not provided because webbrowsers do not provide this value. )rIrKrJrL)r )r0rIrJrKrLr2r2r3_get_file_streams zRequest._get_file_stream)rcCst|jjdS)z``True`` if the request method carries content. By default this is true if a ``Content-Type`` is sent. .. versionadded:: 0.8 CONTENT_TYPE)boolrr()r0r2r2r3want_form_data_parsedszRequest.want_form_data_parsedcCs |j|j|j|j|j|j|jS)zCreates the form data parser. Instantiates the :attr:`form_data_parser_class` with some parameters. .. versionadded:: 0.8 )form_data_parser_classrMr)r*max_form_memory_sizemax_content_lengthparameter_storage_class)r0r2r2r3make_form_data_parserszRequest.make_form_data_parsercCsld|jkrdS|jr8|j}|j|j|j|j|j}n|j|j |j f}|j}|\|d<|d<|d<dS)auMethod used internally to retrieve submitted data. After calling this sets `form` and `files` on the request object to multi dicts filled with the incoming form data. As a matter of fact the input stream will be empty afterwards. You can also call this method to force the parsing of the form data. .. versionadded:: 0.8 formNstreamfiles) __dict__rPrUparse_get_stream_for_parsingmimetyperLZmimetype_paramsrWrT)r0parserdatadr2r2r3_load_form_datas   zRequest._load_form_datacCs"t|dd}|dk rt|S|jS)zThis is the same as accessing :attr:`stream` with the difference that if it finds cached data from calling :meth:`get_data` first it will create a new stream out of the cached data. .. versionadded:: 0.9.3 _cached_dataN)getattrrrW)r0Z cached_datar2r2r3r[/s zRequest._get_stream_for_parsingcCs2|jjd}x t|pfD]\}}|jqWdS)zCloses associated resources of this request object. This closes all file handles explicitly. You can also use the request object in a with statement which will automatically close it. .. versionadded:: 0.9 rXN)rYr(r r:)r0rX_keyvaluer2r2r3r:;s z Request.closecCs|S)Nr2)r0r2r2r3 __enter__FszRequest.__enter__cCs |jdS)N)r:)r0exc_type exc_valuetbr2r2r3__exit__IszRequest.__exit__cCs|jrtdt|jS)a7 If the incoming form data was not encoded with a known mimetype the data is stored unmodified in this stream for consumption. Most of the time it is a better idea to use :attr:`data` which will give you that data as a string. The stream only returns the data once. Unlike :attr:`input_stream` this stream is properly guarded that you can't accidentally read past the length of the input. Werkzeug will internally always refer to this stream to read data which makes it possible to wrap this object with a stream that does filtering. .. versionchanged:: 0.9 This stream is now always available but might be consumed by the form parser later on. Previously the stream was only set if no parsing happened. zXThis request was created with 'shallow=True', reading from the input stream is disabled.)r RuntimeErrorrr)r0r2r2r3rWLszRequest.streamz wsgi.inputzThe WSGI input stream. In general it's a bad idea to use this one because you can easily read past the boundary. Use the :attr:`stream` instead.)doccCs |jddS)z Contains the incoming request data as string in case it came with a mimetype Werkzeug does not handle. T)parse_form_data)get_data)r0r2r2r3r^osz Request.datazte.Literal[False])cacheas_textrlrcCsdS)Nr2)r0rnrorlr2r2r3rmwszRequest.get_data.zte.Literal[True]cCsdS)Nr2)r0rnrorlr2r2r3rmscCsLt|dd}|dkr4|r |j|jj}|r4||_|rH|j|j|j}|S)aThis reads the buffered incoming data from the client into one bytes object. By default this is cached but that behavior can be changed by setting `cache` to `False`. Usually it's a bad idea to call this method without checking the content length first as a client could send dozens of megabytes or more to cause memory problems on the server. Note that if the form data was already parsed this method will not return anything as form data parsing does not cache the data like this method does. To implicitly invoke form data parsing function set `parse_form_data` to `True`. When this is done the return value of this method will be an empty string if the form parser handles the data. This generally is not necessary as if the whole data is cached (which is the default) the form parser will used the cached data to parse the form data. Please be generally aware of checking the content length first in any case before calling this method to avoid exhausting server memory. If `as_text` is set to `True` the return value will be a decoded string. .. versionadded:: 0.9 raN)rbr`rWreadradecoder)r*)r0rnrorlrvr2r2r3rms  zImmutableMultiDict[str, str]cCs|j|jS)aDThe form parameters. By default an :class:`~werkzeug.datastructures.ImmutableMultiDict` is returned from this function. This can be changed by setting :attr:`parameter_storage_class` to a different type. This might be necessary if the order of the form data is important. Please keep in mind that file uploads will not end up here, but instead in the :attr:`files` attribute. .. versionchanged:: 0.9 Previous to Werkzeug 0.9 this would only contain form data for POST and PUT requests. )r`rV)r0r2r2r3rVsz Request.formzCombinedMultiDict[str, str]cCsT|jg}|jdkr|j|jg}x(|D] }t|ts>t|}|j|q(Wt|S)aA :class:`werkzeug.datastructures.CombinedMultiDict` that combines :attr:`args` and :attr:`form`. For GET requests, only ``args`` are present, not ``form``. .. versionchanged:: 2.0 For GET requests, only ``args`` are present, not ``form``. r)r4rappendrV isinstancer r)r0sourcesr4r_r2r2r3valuess     zRequest.valuesz$ImmutableMultiDict[str, FileStorage]cCs|j|jS)a:class:`~werkzeug.datastructures.MultiDict` object containing all uploaded files. Each key in :attr:`files` is the name from the ````. Each value in :attr:`files` is a Werkzeug :class:`~werkzeug.datastructures.FileStorage` object. It basically behaves like a standard file object you know from Python, with the difference that it also has a :meth:`~werkzeug.datastructures.FileStorage.save` function that can store the file on the filesystem. Note that :attr:`files` will only contain data if the request method was POST, PUT or PATCH and the ``
`` that posted to the request had ``enctype="multipart/form-data"``. It will be empty otherwise. See the :class:`~werkzeug.datastructures.MultiDict` / :class:`~werkzeug.datastructures.FileStorage` documentation for more details about the used data structure. )r`rX)r0r2r2r3rXsz Request.filescCs|jS)zgAlias for :attr:`self.root_path`. ``environ["SCRIPT_ROOT"]`` without a trailing slash. )r")r0r2r2r3 script_rootszRequest.script_rootcCs|jS)zAlias for :attr:`root_url`. The URL with scheme, host, and root path. For example, ``https://example.com/app/``. )Zroot_url)r0r2r2r3url_rootszRequest.url_rootZ REMOTE_USERzIf the server supports user authentication, and the script is protected, this attribute contains the username the user has authenticated as.zwsgi.multithreadz[boolean that is `True` if the application is served by a multithreaded WSGI server.zwsgi.multiprocesszlboolean that is `True` if the application is served by a WSGI server that spawns multiple processes.z wsgi.run_oncezboolean that is `True` if the application will be executed only once in a process lifetime. This is the case for CGI for example, but it's not guaranteed that the execution only happens one time.cCs|jS)zThe parsed JSON data if :attr:`mimetype` indicates JSON (:mimetype:`application/json`, see :attr:`is_json`). Calls :meth:`get_json` with default arguments. )get_json)r0r2r2r3json"sz Request.json)forcesilentrnrc Cs|r|j|tk r|j|S|p$|js*dS|j|d}y|jj|}Wnftk r}zJ|rzd}|r|j\}}||f|_n"|j|}|r|j\}} || f|_WYdd}~XnX|r||f|_|S)a&Parse :attr:`data` as JSON. If the mimetype does not indicate JSON (:mimetype:`application/json`, see :attr:`is_json`), this returns ``None``. If parsing fails, :meth:`on_json_loading_failed` is called and its return value is used as the return value. :param force: Ignore the mimetype and always try to parse JSON. :param silent: Silence parsing errors and return ``None`` instead. :param cache: Store the parsed JSON to return for subsequent calls. N)rn) _cached_jsonEllipsisZis_jsonrm json_moduleloads ValueErroron_json_loading_failed) r0r{r|rnr^rrrBZ normal_rv_Z silent_rvr2r2r3ry/s(        zRequest.get_json)rBrcCstd|dS)zCalled if :meth:`get_json` parsing fails and isn't silenced. If this method returns a value, it is used as the return value for :meth:`get_json`. The default implementation raises :exc:`~werkzeug.exceptions.BadRequest`. zFailed to decode JSON object: N)r)r0rBr2r2r3r^szRequest.on_json_loading_failed)TF)NN)TFF)T.F)TFF)FFT)=__name__ __module__ __qualname____doc__rSrGOptionalintrRr rQTyper,rOrrr' classmethodAnyr<CallablerCstrZIObytesrMpropertyrPrUr`r[r:rerirrWrZ input_streamr^typingZoverloadrmUnionrVrvrXrwrxZ remote_userZis_multithreadZis_multiprocessZ is_run_oncerzrr~r}ZTupleryrr __classcell__r2r2)r1r3r s     )"!   $ -r cs.eZdZdZejejddfdd ZZS)StreamOnlyMixinaMixin to create a ``Request`` that disables the ``data``, ``form``, and ``files`` properties. Only ``stream`` is available. .. deprecated:: 2.0 Will be removed in Werkzeug 2.1. Create the request with ``shallow=True`` instead. .. versionadded:: 0.9 N)r4r5rcs*tjdtddd|d<tj||dS)Nzt'StreamOnlyMixin' is deprecated and will be removed in Werkzeug 2.1. Create the request with 'shallow=True' instead.r)r%Tr)r-r.r/r&r')r0r4r5)r1r2r3r'rs zStreamOnlyMixin.__init__)rrrrrGrr'rr2r2)r1r3rgs rcs.eZdZdZejejddfdd ZZS) PlainRequestzA request object without ``data``, ``form``, and ``files``. .. deprecated:: 2.0 Will be removed in Werkzeug 2.1. Create the request with ``shallow=True`` instead. .. versionadded:: 0.9 N)r4r5rc sBtjdtddtj tjdttj||WdQRXdS)Nzq'PlainRequest' is deprecated and will be removed in Werkzeug 2.1. Create the request with 'shallow=True' instead.r)r%ignore)r-r.r/catch_warnings simplefilterr&r')r0r4r5)r1r2r3r's  zPlainRequest.__init__)rrrrrGrr'rr2r2)r1r3r~sr)&rErzrrGr-iorZ _internalrZdatastructuresrrrrr r Z formparserr r Zsansio.requestr Z_SansIORequestutilsrrZwsgirrZwerkzeug.exceptionsrZ TYPE_CHECKINGZtyping_extensionsteZ_typeshed.wsgirrrrr2r2r2r3s>                  M