4V=j+0ddlmZddlZddlZddlZddlZddlmZddl m Z ddl m Z ddl m Z ddlmZddlmZdd lmZdd lmZdd lmZdd lmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlmZd dlm Z d dlm!Z!d dl"m#Z#d dl"m$Z$d dl"m%Z%d dl"m&Z&d dl"m'Z'd dl(m)Z)d dl(m*Z*d dl(m+Z+d d l(m,Z,d d!l(m-Z-d d"l(m.Z.d d#l/m0Z0d d$l/m1Z1d d%l2m3Z3d d&l2m4Z4d d'l5m6Z6d d(l7m8Z8d d)l9m:Z:d d*l9m;Z;ej<rddl=Z>dd+l?m@Z@dd,l?mAZA dXdYd9ZB dZd[d<ZCd\d>ZDejEd?d@AZFGdBdCZGGdDdEeHZIGdFdGZJd]dLZK d^d_dSZLGdTdUe8ZMejNGdVdWZOdS)`) annotationsN) defaultdict)datetime)BytesIO)chain)random) TemporaryFile)time)unquote)urlsplit) urlunsplit) _get_environ)_wsgi_decoding_dance)_wsgi_encoding_dance) Authorization) CallbackDict)CombinedMultiDict)EnvironHeaders) FileMultiDict)Headers) MultiDict) dump_cookie)dump_options_header) parse_cookie) parse_date)parse_options_header)Data)Epilogue)Field)File)MultipartEncoder)Preamble) _urlencode) iri_to_uri)cached_property)get_content_type)Request)Response)ClosingIterator)get_current_url)WSGIApplication)WSGIEnvironmentTdatat.Mapping[str, t.Any] use_tempfilebool thresholdintboundary str | Nonereturntuple[t.IO[bytes], int, str]c |dtt}tdd|r dfd }nj}t |}||td t|D]\}}t|d d}|:t|d t|dd} t|dd} | | rtj | dpd} |j } | d| fg| .||t|| n.||t|| |  |d} | s.||t!| dn.||t!| diTt#|t$st%|}||t|t'||t!|d||t)d } d| |fS)zEncode a dict of values (either strings or file descriptors or :class:`FileStorage` objects.) into a multipart encoded string stored in a file descriptor. .. versionchanged:: 3.0 The ``charset`` parameter was removed. Nz ---------------WerkzeugFormPart_rFsbytesr7r4cr|St|}|zkr|nwtjtjt t d}||||d|z |S)Nzwb+T)writelentcastIOr;r getvalue)r:length new_streamon_diskstreamr3 total_lengths ;C:\PYTHON\_runtimes\venv\Lib\site-packages\werkzeug/test.py write_binaryz-stream_encode_multipart..write_binaryMs ||A&QL(I55LLOOOO!"U ]55I5I!J!JJ$$V__%6%6777$$Q''''F"G&  rJ)r/readfilenamename content_typezapplication/octet-stream Content-Type)rMheaders)rMrLrPTi@)r/ more_data)r:r;r7r4)r rrr=r"encode send_eventr# _iter_datagetattr mimetypes guess_typerPupdater r!r isinstancestrrrtellseek)r/r1r3r5rIencoderkeyvaluereaderrLrNrPchunkrCrErFrGs ` @@@rHstream_encode_multipartrb6s6HdffHfhhHH!))FLG$          *| x0011GL##H#$6$6$677888 &&!Y!Y U--  uj'%2N2NOOH"5.$??L#:!,X66q921 mG NN^\:; < < < W//30P0P0PQQRRRR &&#'JJJ  Su  L!3!3Deu4U4U4U!V!VWWW W//%40P0P0PQQRRR S eS)) #E  L++EsGII,N,N,NOO P P P L++DellnnPU,V,V,VWW X X X XL##H#$6$6$677888 [[]]F KKNNN 68 ##rJvaluestuple[str, bytes]cZt|d|\}}}||fS)zLike `stream_encode_multipart` but returns a tuple in the form (``boundary``, ``data``) where data is bytes. .. versionchanged:: 3.0 The ``charset`` parameter was removed. F)r1r5)rbrK)rcr5rFrCs rHencode_multipartrfs; 7UX   FFH V[[]] ""rJt.Iterator[tuple[str, t.Any]]c#Kt|tr|dEd{VdS|D],\}}t|tr |D]}||fV &||fV-dS)zIterate over a mapping that might have a list of values, yielding all key, value pairs. Almost like iter_multi_items but only allows lists, not tuples, of values so tuples can be used for files. T)multiN)rYritemslist)r/r^r_vs rHrTrTs $ ""!::D:)))))))))))**,, ! !JC%&& !!!Aq&LLLL!5j     ! !rJ_TAnyMultiDictzMultiDict[t.Any, t.Any])boundcfeZdZUdZdZdZeZddlZe ej Z [de d<de d <d e d <de d <d e d< ddded/Z edfd4Zdgd8Ze dhd<Zedid=Zejdjd>Zedkd?Zejdjd@ZedkdAZejdldBZedmdDZedndEZejdodFZdpdKZdqdMZedrdOZejdsdPZedtdRZejdudSZedvdTZejdwdUZedidVZejdjdWZedrdXZejdxdYZedidZZ edyd\Z!dzd]Z"dzd^Z#d{d_Z$d|d}dcZ%dS)~EnvironBuildera+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:`Response.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 auth: An authorization object to use for the ``Authorization`` header value. A ``(username, password)`` tuple is a shortcut for ``Basic`` authorization. .. versionchanged:: 3.0 The ``charset`` parameter was removed. .. versionchanged:: 2.1 ``CONTENT_TYPE`` and ``CONTENT_LENGTH`` are not duplicated as header keys in the environ. .. versionchanged:: 2.0 ``REQUEST_URI`` and ``RAW_URI`` is the full raw URI including the query string, not only the path. .. versionchanged:: 2.0 The default :attr:`request_class` is ``Request`` instead of ``BaseRequest``. .. versionadded:: 2.0 Added the ``auth`` parameter. .. 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 percent-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`. zHTTP/1.1)rrrNMultiDict[str, str] | None_argsr6 _query_stringt.IO[bytes] | None _input_stream_formzFileMultiDict | None_files/GETFpathrZbase_url query_string t.Mapping[str, str] | str | Nonemethod input_streamrNcontent_length int | None errors_streamt.IO[str] | None multithreadr2 multiprocessrun_oncerP,Headers | t.Iterable[tuple[str, str]] | Noner/:None | (t.IO[bytes] | str | bytes | t.Mapping[str, t.Any]) environ_baset.Mapping[str, t.Any] | Noneenviron_overridesmimetypejsonauth&Authorization | tuple[str, str] | Noner7NonecZ|d|vrtdt|}| d|vr|j}t|j|_||_|t|}||_t|tr||_ n<|t}n$t|tst|}||_ ||_ | t} n$t| tst| } | |_|||_| t j}||_| |_| |_| |_||_||_||_||_d|_|at|t6rt9d|d|dd}|jd||4| t?d | |} |jd |_| r(|t?d tC| d r| "} t| tr| #} t| tHr0tK| |_|jtM| |_ntO| D]u\}}t|t6tPfstC|d r|)||H|j*+|,|v| ||_-dSdS) N?z6Query string is defined in the path and as an argumentFbasicrr)usernamepasswordrz can't provide both json and datazapplication/jsonz#can't provide input stream and datarK). ValueErrorr queryr%rz request_urir{rYrZr|rargsr~rrPrNsysstderrrrrrrrrrclosedtuplerset to_header TypeError json_dumpshasattrrKrRr;rr>rTdict_add_file_from_dataformsetlistdefaultappendr)selfrzr{r|r~rrNrrrrrrPr/rrrrrrr^r_s rH__init__zEnvironBuilder.__init__*s9*  #t UVV Vtnn  C4KK&,L{/00   !(++H  lC ( ( % ,D  #({{  i88 7(66 $DI ?iiGGGW-- 'g&&G  # ,D   JM*&(  (!2(,  $&& $$q'tAwGG L  _dnn.>.> ? ? ?   BCCC??4((D ($6!  D' EFFFtV$$ #yy{{$$$ %{{}}$&& D$+DMM!&.*-d))D'",T"2"2DDJC!%%77D75&;Q;QD00e<<<< 0055<>**)* F##$W]%;<< 11HII./#L1#KK==%kk*:DAA$]3"#56#$780!  $ 6szzSzzrJr^r_Dt.IO[bytes] | tuple[t.IO[bytes], str] | tuple[t.IO[bytes], str, str]ct|tr|jj|g|RdS|j||dS)z=Called in the EnvironBuilder to add files from the data dict.N)rYrfilesadd_file)rr^r_s rHrz"EnvironBuilder._add_file_from_datasW eU # # , DJ  ,e , , , , , , J  U + + + + +rJschemehost script_rootcVt|||ddfddzS)Nrx)r rstrip)rrrs rHrzEnvironBuilder._make_base_urls.64b"=>>EEcJJSPPrJcN||j|j|jS)z`The base URL is used to extract the URL scheme, host name, port, and root path. )r url_schemerrrs rHr{zEnvironBuilder.base_urls# ""4?DIt?OPPPrJc|d}d}d}n(t|\}}}}}|s|rtd|d|_||_||_dS)Nhttp localhostrz4base url must not contain a query string or fragmentrx)r rrrrr)rr_rnetlocrqsanchors rHr{zEnvironBuilder.base_urlsv =F FKK6>uoo 3FFKV YV Y !WXXX&--c22  rJct|jd}||js|jrdS|jrdSdS|S)zThe 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. rONmultipart/form-data!application/x-www-form-urlencoded)rPgetrurwrvrcts rHrNzEnvironBuilder.content_typesO \  n - - :d0:{ -,,z ;::4 rJcX||jdddS||jd<dSNrO)rPrrr_s rHrNzEnvironBuilder.content_types7 = L  ^T 2 2 2 2 2+0DL ( ( (rJcr|j}|r-|ddndS)zYThe mimetype (content type without charset etc.) .. versionadded:: 0.14 ;rN)rNsplitstriprs rHrzEnvironBuilder.mimetypes7  +-7rxx}}Q%%'''47rJc0t|d|_dS)Nzutf-8)r'rNrs rHrzEnvironBuilder.mimetypes,UG<<rJt.Mapping[str, str]cd fd }tjddd}t||S) zThe 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 dCallbackDict[str, str]r7rcBtj|jd<dSr)rrrP)rrs rH on_updatez1EnvironBuilder.mimetype_params..on_updates!+>t}a+P+PDL ( ( (rJz content-typerr)rrr7r)rrPrr)rrrs` rHmimetype_paramszEnvironBuilder.mimetype_paramss] Q Q Q Q Q Q !!1!1."!E!E F Fq IAy)))rJcD|jdtS)zThe 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. r)type)rPrr4rs rHrzEnvironBuilder.content_lengths | 0s;;;rJcr||jdddSt||jd<dS)Nr)rPrrZrs rHrzEnvironBuilder.content_length s? = L  -t 4 4 4 4 4-0ZZDL) * * *rJrMstoragetype[_TAnyMultiDict]rmc|jtdt||}||}t||||S)zCommon 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. Nzan input stream is defined)rAttributeErrorrUsetattr)rrMrrvs rH _get_formzEnvironBuilder._get_formsR   ( !=>> > T4  :B D$ # # # rJMultiDict[str, t.Any]c6d|_t|||dS)zCommon 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)rur)rrMr_s rH _set_formzEnvironBuilder._set_form$s$"dE"""""rJMultiDict[str, str]c8|dtS)z$A :class:`MultiDict` of form values.rv)rrrs rHrzEnvironBuilder.form.s~~gy111rJc2|d|dS)Nrvrrs rHrzEnvironBuilder.form3s w&&&&&rJrc8|dtS)zrA :class:`FileMultiDict` of uploaded files. Use :meth:`~FileMultiDict.add_file` to add new files. rw)rrrs rHrzEnvironBuilder.files7s ~~h 666rJc2|d|dS)Nrwrrs rHrzEnvironBuilder.files>s x'''''rJc|jS)zAn optional input stream. This is mutually exclusive with setting :attr:`form` and :attr:`files`, setting it will clear those. Do not provide this if the method is not ``POST`` or another method that has a body. )rurs rHrzEnvironBuilder.input_streamBs !!rJc0||_d|_d|_dSN)rurvrwrs rHrzEnvironBuilder.input_streamKs"  rJcX|j|jt|jSdS|jS)ziThe query string. If you set this to a string :attr:`args` will no longer be available. Nr)rsrrr$rs rHr|zEnvironBuilder.query_stringQs3   %z%!$*---2!!rJc"||_d|_dSrrsrrrs rHr|zEnvironBuilder.query_string\s" rJcp|jtd|jt|_|jS)z(The URL arguments as :class:`MultiDict`.Nza query string is defined)rsrrrrrs rHrzEnvironBuilder.argsas7   ) !<== = : "DJzrJc"d|_||_dSrrrs rHrzEnvironBuilder.argsjs! rJcD|jdddS)z4The server name (read-only, use :attr:`host` to set):rr)rrrs rH server_namezEnvironBuilder.server_nameosysA&&q))rJr4c|jdd}t|dkr& t|dS#t$rYnwxYw|jdkrdSdS)z?The server port as integer (read-only, use :attr:`host` to set)rrhttpsiP)rrr>r4rr)rpiecess rH server_portzEnvironBuilder.server_porttsxa(( v;;!   6!9~~%     ?g % %3rsA AAcR |dS#t$rYdSwxYwr)close Exceptionrs rH__del__zEnvironBuilder.__del__s:  JJLLLLL    DD s  &&c|jrdS |j}n#t$rd}YnwxYw|D]'} |#t $rY$wxYwd|_dS)zCloses 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. NrT)rrrcrr r)rrfs rHr zEnvironBuilder.closes ;  F J%%''EE   EEE   A       s% 44A AAcN|j}|j}|j}|j}|Y|}|dd|}||||z }n|dkr5t t|j|j g\}}}|d|d}nZ|dkrFt|j d}t|}t|}nt}i} |jr| |jd&d } t!|j} | id |jd| |jd| |jdt!|jd| d| d|jdt/|jd|jd|jd|jd|jd|d|jd|jd|jd|j |j!"} | #d| #d||| d <|t/|| d!<tItJ} | &D]I\}}| d"|'(d#d$)|J| *D]\}}d%+|| |<|j,r| |j,| S)'zReturn 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. Nrrrz ; boundary=""rasciixrZr7c:tt|Sr)rr )rs rH _path_encodez0EnvironBuilder.get_environ.._path_encodes' 33 3rJrrrr REQUEST_URIRAW_URI SERVER_NAME SERVER_PORT HTTP_HOSTSERVER_PROTOCOLz wsgi.versionrrrrrrrOr CONTENT_TYPECONTENT_LENGTHHTTP_-_z, )rrZr7rZ)-rrrrNr[r\rbrrrr$rRr>rrrXrrr~rrzr|rrZr rserver_protocol wsgi_versionrrrrrrPcopyremoverrk to_wsgi_listupperreplacerrjjoinr)rrrrrN start_posend_posr5 form_encodedresultrraw_urirPcombined_headersr^r_rcs rH get_environzEnvironBuilder.get_environs( ,=(  #$))++I   a # # #"''))G   i ( ( ($y0NN . . .5L!49dj"9::66 2L.('??H???LL < < <%di0077@@L ..N"<00LL"99L"$   - MM$+ , , , 4 4 4 4't'788   $+ ||D,<== \\$)44  4T5F G G   w  7 t/ s4#344 TY "4#7  1 "4? l  t1! "#D$4# $$T%6% & '    0,##%%~&&&'(((  #%1F> "  %'*>':':F# $&t,,!..00 T TJC DSYY[[%8%8c%B%BDD E L LU S S S S+1133 , ,KC))F++F3KK  ! 2 MM$0 1 1 1 rJrtype[Request] | Noner(cN||j}||S)zReturns a request with the data. If the request class is not specified :attr:`request_class` is used. :param cls: The request wrapper to use. ) request_classr1)rrs rH get_requestzEnvironBuilder.get_requests- ;$Cs4##%%&&&rJ)rxNNryNNNNFFFNNNNNNN)&rzrZr{r6r|r}r~rZrrtrNr6rrrrrr2rr2rr2rPrr/rrrrrrr6rrrrr7r)rr-rrr7rp)r^rZr_rr7r)rrZrrZrrZr7rZr7rZ)r_r6r7r)r7r6)r_rZr7r)r7r)r7r)r_rr7r)rMrZrrr7rm)rMrZr_rr7r)r7r)r_rr7r)r7r)r_rr7r)r7rt)r_rtr7r)r_rqr7r)r7r4)r7r)r7r-r)rr2r7r()&__name__ __module__ __qualname____doc__r#r$r(r4r staticmethoddumpsr__annotations__r classmethodrrrpropertyr{setterrNrrrrrrrrr|rrr rr r1r5rrJrHrprps``F!OLMKKKdj))J %%%%%%%%%%%%    #9=+/#'%)*.!"@DKO59:>#-17;'`%`%`%`%`%D[@ , , , ,QQQ\QQQQXQ _ ! ! !_ !   X 1111 888X8_===_= * * *X *<<<X<8888 $####222X2 ['''['777X7  \(((\("""X" """X"X [[***X*   X  $VVVVp ' ' ' ' ' ' 'rJrpceZdZdZdS)ClientRedirectErrorzIf a redirect loop is detected when using follow_redirects=True with the :cls:`Client`, then this exception is raised. N)r7r8r9r:rrJrHrBrBsrJrBceZdZdZ d;ddZ d?ddddd@dZddddAdZdBd"ZdCd&Z dDdEd)Z dDdFd,Z ddd-dGd0Z dHd2Z dHd3ZdHd4ZdHd5ZdHd6ZdHd7ZdHd8ZdHd9ZdId:ZdS)JClientaSimulate sending requests to a WSGI application without running a WSGI or HTTP server. :param application: The WSGI application to make requests to. :param response_wrapper: A :class:`.Response` class to wrap response data with. Defaults to :class:`.TestResponse`. If it's not a subclass of ``TestResponse``, one will be created. :param use_cookies: Persist cookies from ``Set-Cookie`` response headers to the ``Cookie`` header in subsequent requests. Domain and path matching is supported, but other cookie parameters are ignored. :param allow_subdomain_redirects: Allow requests to follow redirects to subdomains. Enable this if the application handles subdomains and redirects between them. .. versionchanged:: 2.3 Simplify cookie implementation, support domain and path matching. .. versionchanged:: 2.1 All data is available as properties on the returned response object. The response cannot be returned as a tuple. .. versionchanged:: 2.0 ``response_wrapper`` is always a subclass of :class:``TestResponse``. .. versionchanged:: 0.5 Added the ``use_cookies`` parameter. NTF applicationr,response_wrappertype[Response] | None use_cookiesr2allow_subdomain_redirectsr7rc||_|dthvrt}n/|-t|tst dt|fi}t jtd||_|ri|_nd|_||_ dS)NWrapperTestResponse TestResponse) rEr)rL issubclassrr?r@rF_cookiesrI)rrErFrHrIs rHrzClient.__init__!s' h/ / /+    )* l3 3 ) $%/0    !"tN';=M N N  !GIDMM DM)B&&&rJrrxr^rZdomainrz Cookie | Nonech|jtd|j|||fS)aDReturn a :class:`.Cookie` if it exists. Cookies are uniquely identified by ``(domain, path, key)``. :param key: The decoded form of the key for the cookie. :param domain: The domain the cookie was set for. :param path: The path the cookie was set for. .. versionadded:: 2.3 N>Cookies are disabled. Create a client with 'use_cookies=True'.)rNrrrr^rOrzs rH get_cookiezClient.get_cookie>s@ = P }  &$!4555rJr)rO origin_onlyrzr_rUrrc |jtdt|dt ||f||d|}||_|jr"|j|jddS||j|j<dS)a~Set a cookie to be sent in subsequent requests. This is a convenience to skip making a test request to a route that would set the cookie. To test the cookie, make a test request to a route that uses the cookie value. The client uses ``domain``, ``origin_only``, and ``path`` to determine which cookies to send with a request. It does not use other cookie parameters that browsers use, since they're not applicable in tests. :param key: The key part of the cookie. :param value: The value part of the cookie. :param domain: Send this cookie with requests that match this domain. If ``origin_only`` is true, it must be an exact match, otherwise it may be a suffix match. :param origin_only: Whether the domain must be an exact match to the request. :param path: Send this cookie with requests that match this path either exactly or as a prefix. :param kwargs: Passed to :func:`.dump_cookie`. .. versionchanged:: 3.0 The parameter ``server_name`` is removed. The first parameter is ``key``. Use the ``domain`` and ``origin_only`` parameters instead. .. versionchanged:: 2.3 The ``origin_only`` parameter was added. .. versionchanged:: 2.3 The ``domain`` parameter defaults to ``localhost``. NrRrxrOrz) rNrCookie_from_response_headerrrU_should_deleter _storage_key)rr^r_rOrUrzrcookies rH set_cookiezClient.set_cookieQsP = P -- CS%TTTTVTT  )   8 M  f14 8 8 8 8 817DM&- . . .rJrWcn|jtd|j|||fddS)aDelete a cookie if it exists. Cookies are uniquely identified by ``(domain, path, key)``. :param key: The decoded form of the key for the cookie. :param domain: The domain the cookie was set for. :param path: The path the cookie was set for. .. versionchanged:: 3.0 The ``server_name`` parameter is removed. The first parameter is ``key``. Use the ``domain`` parameter instead. .. versionchanged:: 3.0 The ``secure``, ``httponly`` and ``samesite`` parameters are removed. .. versionchanged:: 2.3 The ``domain`` parameter defaults to ``localhost``. NrR)rNrrrSs rH delete_cookiezClient.delete_cookiesH0 = P  64-t44444rJrr-c|jdStt|jpddfd|jD}|r||d<dS|dddS)zIf cookies are enabled, set the ``Cookie`` header in the environ to the cookies that are applicable to the request host and path. :meta private: .. versionadded:: 2.3 Nrz; c3vK|]3}|j|V4dSr)_matches_requestrz_to_request_header).0crurls rH z.Client._add_cookies_to_wsgi..s[  !!+sx88 " "      rJ HTTP_COOKIE)rNr r+hostnamer*rcr)rrr_rrfs @@rH_add_cookies_to_wsgizClient._add_cookies_to_wsgis = Fw//00l1k       ]))++       -%*GM " " " KK t , , , , ,rJrrP list[str]c|jdS|D]U}t|||}|jr!|j|jdF||j|j<VdS)zIf cookies are enabled, update the stored cookies from any ``Set-Cookie`` headers in the response. :meta private: .. versionadded:: 2.3 N)rNrXrYrZrr[)rrrzrPheaderr\s rH_update_cookies_from_responsez$Client._update_cookies_from_responses| = F < 34HEADryzTransfer-Encodingrr)r locationrprrequestrrrrrr>rI RuntimeErrorrrz status_coder~rr rNrrPropen) rrurorrrzrrbuilder to_name_partsfrom_name_parts path_parts root_partss rHresolve_redirectzClient.resolve_redirects,4H4E+F+F(b& --   $4b.   S!,,Q/55c:: !-33C88 RD !'G !GLL,M O + +c/222445HH5X&'VWWWX##STTTZZ__ (..s33 'J' (J 6 6G$7 8 8 : :;GLL GL"$G   z 1 1~''!&#/$**,,,'+$#'G %)G " O   3T : : :yy8y444rJ)rofollow_redirectsrrcRd}|st|dkr|d}t|tr|}nYt|tr-t|}nt|t r|}|Ot|i|} |}|n#|wxYw||j |}|j |d|i} t} g} |s| S| j dvr|s(| | | j| j f} | | vr td| j d| jd | | t#| | _| | || |} | j dvt#| | _| |jj| S) a|Generate an environ dict from the given arguments, make a request to the application using it, and return the response. :param args: Passed to :class:`EnvironBuilder` to create the environ for the request. If a single arg is passed, it can be an existing :class:`EnvironBuilder` or an environ dict. :param buffered: Convert the iterator returned by the app into a list. If the iterator has a ``close()`` method, it is called automatically. :param follow_redirects: Make additional requests to follow HTTP redirects until a non-redirect status is returned. :attr:`TestResponse.history` lists the intermediate responses. .. versionchanged:: 2.1 Removed the ``as_tuple`` parameter. .. versionchanged:: 2.0 The request input stream is closed when calling ``response.close()``. Input streams for redirects are automatically closed. .. 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`` instead of ``mimetype``. This change was made for consistency with :class:`werkzeug.FileWrapper`. .. versionchanged:: 0.5 Added the ``follow_redirects`` parameter. Nrrrrr|>-./1rxryzLoop detected: A z redirect to z was already made.)r>rYrpr5rrr(r rsrrFrr~ make_sequencer{rBaddrhistoryrr call_on_closer) rrorrrr|argrresponse_partsru redirectsrnew_redirect_entrys rHrz Client.open"scL#' #d))q..q'C#~.. //++C&& (55c::FFHHC))  ?$d5f55G !--//  **7?X*NN(4(.J'JJEE &( O"'    !&&(((   "*"3X5I!J !Y..)A(<AA#,AAA MM, - - -$W~~H  NN8 $ $ $,,X,IIH3"'   8 %W~~H   " "7#7#= > > >Os 2CC1kwc&d|d<|j|i|S)z1Call :meth:`open` with ``method`` set to ``GET``.ryr~rrrrs rHrz Client.get"8 ty$%"%%%rJc&d|d<|j|i|S)z2Call :meth:`open` with ``method`` set to ``POST``.POSTr~rrs rHpostz Client.post"8 ty$%"%%%rJc&d|d<|j|i|S)z1Call :meth:`open` with ``method`` set to ``PUT``.PUTr~rrs rHputz Client.putrrJc&d|d<|j|i|S)z4Call :meth:`open` with ``method`` set to ``DELETE``.DELETEr~rrs rHdeletez Client.deletes"8 ty$%"%%%rJc&d|d<|j|i|S)z3Call :meth:`open` with ``method`` set to ``PATCH``.PATCHr~rrs rHpatchz Client.patch"8 ty$%"%%%rJc&d|d<|j|i|S)z5Call :meth:`open` with ``method`` set to ``OPTIONS``.OPTIONSr~rrs rHoptionszClient.optionss" 8 ty$%"%%%rJc&d|d<|j|i|S)z2Call :meth:`open` with ``method`` set to ``HEAD``.rzr~rrs rHheadz Client.headrrJc&d|d<|j|i|S)z3Call :meth:`open` with ``method`` set to ``TRACE``.TRACEr~rrs rHtracez Client.tracerrJcBdt|jd|jdS)N< >)rr7rErs rH__repr__zClient.__repr__s'>4::&>>)9>>>>rJ)NTF) rEr,rFrGrHr2rIr2r7r)rrx)r^rZrOrZrzrZr7rP)r)r^rZr_rZrOrZrUr2rzrZrrr7r)r^rZrOrZrzrZr7r)rr-r7r)rrZrzrZrPrkr7rF)rr-ror2r7rp)rurLror2r7rL) rrror2rr2rrr7rL)rrrrr7rLr6)r7r8r9r:rrTr]r_rjrnrsrrrrrrrrrrrrrJrHrDrDs<37 */ CCCCC<@C66666,58 " 585858585858v" 555555>----0<<<<,:?      8==5=5=5=5=5D!& ccccccJ&&&& &&&& &&&& &&&& &&&& &&&& &&&& &&&& ??????rJrDrrrr-ct|i|} ||S#|wxYw)aCreate 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. )rpr1r )rrrs rHcreate_environrsKd-f--G""$$  s 6A Fappr,rrorpc t|}d g d fd }|||}t|dd}t|}|r/ t |}| |nX#| |wwxYw|D]} | n rt |}|||urt||} \}} ||t| fS)aReturn 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)`` Ncp|r) |d|d#d}wxYw||fjS)Nrr)with_tracebackr)statusrPexc_infobufferrus rHstart_responsez$run_wsgi_app..start_responsesN   qk00!===G$}s!&*r r) rr%rUiterrkrrr*r) rrrorapp_rv close_funcapp_iteritemrrPrrus @@rHrsrssN*7##((**G9=HF       S. ) )F$//J"&v,,H= H~~H% % &  D MM$   #$  /VX..H  !hf&<&<&x<rz startswith)rrrzs rHrbzCookie._matches_requests 4; & $$C((55C 33t{#3#3"3 34==cBB   DI   **UTY$)*<*((-- Q%),v*>*>*D*D*F*F%G%G" ]"((-- C CDs++IAsA58(B dF17799??$$ % %s ++--#'vzz)44553<3F3FCy).Q///D::h''6; .F##Ets';';A'>E#v% F*jj,,    rJtuple[str, str, str]c*|j|j|jfSr)rOrzrrs rHr[zCookie._storage_keys{DIt'777rJcd|jdkp%|jduo|jdkS)Nr)rr timestamprs rHrZzCookie._should_deletes8|q  L $ F)?)?)A)AQ)F rJN)rrZrzrZr7r2r6)rrZrzrZrmrZr7r)r7r)r7r2) r7r8r9r:r=rbrcr>rYr?r[rZrrJrHrXrXQsZ HHH;JJJ;JL:KKKSIII/#%%    ****   [ 2888X8   X   rJrX)Tr.N) r/r0r1r2r3r4r5r6r7r8r)rcr0r5r6r7rd)r/r0r7rg)rrrrr7r-r)rr,rr-ror2r7rp)P __future__r dataclassesrVrtypingr? collectionsrrior itertoolsrrtempfiler r urllib.parser r r _internalrrrdatastructuresrrrrrrrrrrrrrsansio.multipartrrr r!r"r#urlsr$r%utilsr&r'wrappers.requestr(wrappers.responser)wsgir*r+ TYPE_CHECKINGtyping_extensionste_typeshed.wsgir,r-rbrfrTTypeVarrmrprrBrDrrsrL dataclassrXrrJrHrs"""""" ######"""""" !!!!!!############++++++++++++))))))((((((------******))))))######%%%%%%%%%%%%&&&&&&""""""&&&&&&######""""""......&&&&&&""""""######%%%%%%''''''!!!!!!!!!!!!?/""""............  W$W$W$W$W$v;? # # # # # ! ! ! ! +3LMMMJ 'J 'J 'J 'J 'J 'J 'J 'Z) k?k?k?k?k?k?k?k?\ 0FKE.E.E.E.E.P<+<+<+<+<+8<+<+<+~ f f f f f f f f f f rJ