Files
old-parkingkoncept/parkingkonceptvenv/lib/python3.7/site-packages/werkzeug/__pycache__/test.cpython-37.pyc

409 lines
33 KiB
Plaintext
Raw Normal View History

2019-11-17 12:44:16 +01:00
B
<00>/<2F><00>@s<>dZddlZddlZddlmZddlmZddlmZddlm Z ddl
m
Z
dd l m Z dd
l m Z dd l mZdd l mZdd l mZddl mZddl mZddl mZddl mZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"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/dd&l.m0Z0ydd'l1m2Z3Wn"e4k
<EFBFBD>r<>dd'l5m2Z3YnXydd(l6m7Z7Wn"e4k
<EFBFBD>rdd(l8m7Z7YnXdEd,d-<2D>Z9dFd.d/<2F>Z:dGd0d1<64>Z;Gd2d3<64>d3e<<3C>Z=Gd4d5<64>d5e<<3C>Z>Gd6d7<64>d7e7<65>Z?d8d9<64>Z@Gd:d;<3B>d;e<<3C>ZAGd<d=<3D>d=eB<65>ZCGd>d?<3F>d?e<<3C>ZDd@dA<64>ZEdHdCdD<64>ZFdS)Iz<49>
werkzeug.test
~~~~~~~~~~~~~
This module implements a client to WSGI applications for testing.
:copyright: 2007 Pallets
:license: BSD-3-Clause
<EFBFBD>N)<01>BytesIO)<01>chain)<01>random)<01> TemporaryFile)<01>time<6D>)<01> iteritems)<01> iterlists)<01>
itervalues)<01>make_literal_wrapper)<01>reraise)<01> string_types)<01> text_type)<01>to_bytes)<01>wsgi_encoding_dance)<01> _get_environ)<01> CallbackDict)<01>CombinedMultiDict)<01>EnvironHeaders)<01> FileMultiDict)<01> FileStorage)<01>Headers)<01> MultiDict)<01> dump_cookie)<01>dump_options_header)<01>parse_options_header)<01>
iri_to_uri)<01>
url_encode)<01>url_fix)<01> url_parse)<01> url_unparse)<01> url_unquote)<01>get_content_type)<01> BaseRequest)<01>ClosingIterator)<01>get_current_url)<01>Request)<01> CookieJarT<72><00><00>utf-8c s<>|dkrdt<00>t<01>f}t<02>ddg<03>|r8<72><00>fdd<06><08>n
<EFBFBD>dj<03><03><01>fdd<08>}t|t<05>sbt|<00>}<00>xt|<00>D]<5D>\}}x<>|D]<5D>}|d ||f<00>t|d
d<01>}|dk <09>r0t|d t|d d<01><03>} t|d d<01>}
|
dkr<>| r<>t<08> | <09>dp<>d}
| dk r<>|d| <00>n|d<10>|d|
<00>xN|d<12>} | <0B>s P<00>| <0B><00>qWn.t|t
<EFBFBD><02>sDt |<07>}t |<07><01>}|d<13><00>|<07>|d<10>q|WqnW|d|<00>t <0A>d<00><0E><00>} <0C>d<00>d<03><00>d| |fS)z<>Encode a dict of values (either strings or file descriptors or
:class:`FileStorage` objects.) into a multipart encoded string stored
in a file descriptor.
Nz$---------------WerkzeugFormPart_%s%srFcs~<00>\}}}|r|<01>|<00>n`t|<00>}|<04>d<00>kr>|<01>|<00>n0td<02>}|<05>|<01><03><00>|<05>|<00>|<05>d<d<04>d<||<00>d<dS)Nrzwb+rT<>)<04>write<74>lenr<00>getvalue)<06>string<6E>stream<61> total_lengthZon_disk<73>lengthZ
new_stream)<02>_closure<72> threshold<6C><00>3/tmp/pip-install-c3kgu56x/Werkzeug/werkzeug/test.py<70> write_binaryJs
  
z-stream_encode_multipart.<locals>.write_binarycs<00>|<00><00><00><01>dS)N)<01>encode)r.)<02>charsetr6r4r5r+]sz&stream_encode_multipart.<locals>.writez/--%s
Content-Disposition: form-data; name="%s"<22>read<61>filename<6D>name<6D> content_typezapplication/octet-streamz; filename="%s"
z
zContent-Type: %s
i@z
z--%s--
)rrrr+<00>
isinstancerr <00>getattr<74> mimetypes<65>
guess_typer <00>strr<00>int<6E>tell<6C>seek) <0A>values<65> use_tempfiler3<00>boundaryr8r+<00>key<65>value<75>readerr:r<<00>chunkr1r4)r2r8r3r6r5<00>stream_encode_multipart=sN 


 
   
 rLcCs"t|d||d<02>\}}}||<03><01>fS)z|Like `stream_encode_multipart` but returns a tuple in the form
(``boundary``, ``data``) where data is a bytestring.
F)rFrGr8)rLr9)rErGr8r/r1r4r4r5<00>encode_multipart<72>srMcCs(ddlm}|dtdd<05>t|||d<06>S)z/Backwards compat.
.. deprecated:: 0.5
r)<01>warnz<6E>'werkzeug.test.File' is deprecated as of version 0.5 and will be removed in version 1.0. Use 'EnvironBuilder' or 'FileStorage' instead.r*)<01>
stacklevel)r:r<)<04>warningsrN<00>DeprecationWarningr)<04>fdr:<00>mimetyperNr4r4r5<00>File<6C>s  rTc@s*eZdZdZdd<03>Zdd<05>Zd dd<08>ZdS)
<EFBFBD>_TestCookieHeadersz$A headers adapter for cookielib
cCs
||_dS)N)<01>headers)<02>selfrVr4r4r5<00>__init__<5F>sz_TestCookieHeaders.__init__cCs:g}|<01><00>}x(|jD]\}}|<03><00>|kr|<02>|<04>qW|S)N)<03>lowerrV<00>append)rWr;rV<00>k<>vr4r4r5<00>
getheaders<EFBFBD>s  z_TestCookieHeaders.getheadersNcCs>g}x,|jD]"\}}|<04><01>|<01><01>kr |<03>|<05>q W|p<|p<gS)N)rVrYrZ)rWr;<00>default<6C>rvr[r\r4r4r5<00>get_all<6C>s
z_TestCookieHeaders.get_all)N)<07>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rXr]r`r4r4r4r5rU<00>srUc@s eZdZdZdd<03>Zdd<05>ZdS)<07>_TestCookieResponsez<65>Something that looks like a httplib.HTTPResponse, but is actually just an
adapter for our test responses to make them available for cookielib.
cCst|<01>|_dS)N)rUrV)rWrVr4r4r5rX<00>sz_TestCookieResponse.__init__cCs|jS)N)rV)rWr4r4r5<00>info<66>sz_TestCookieResponse.infoN)rarbrcrdrXrfr4r4r4r5re<00>srec@s eZdZdZdd<03>Zdd<05>ZdS)<07>_TestCookieJarz<72>A cookielib.CookieJar modified to inject and read cookie headers from
and to wsgi environments, and wsgi application responses.
cCs2dd<02>|D<00>}|r"d<03>|<02>|d<n |<01>dd<05>dS)zYInject the cookies as client headers into the server's wsgi
environment.
cSsg|]}d|j|jf<00>qS)z%s=%s)r;rI)<02>.0<EFBFBD>cr4r4r5<00>
<listcomp><3E>sz._TestCookieJar.inject_wsgi.<locals>.<listcomp>z; Z HTTP_COOKIEN)<02>join<69>pop)rW<00>environZcvalsr4r4r5<00> inject_wsgi<67>sz_TestCookieJar.inject_wsgicCs|<00>t|<02>tt|<01><01><01>dS)zXExtract the server's set-cookie headers as cookies into the
cookie jar.
N)<04>extract_cookiesre<00> U2Requestr%)rWrmrVr4r4r5<00> extract_wsgi<67>sz_TestCookieJar.extract_wsgiN)rarbrcrdrnrqr4r4r4r5rg<00>s rgccs<>t|t<01>r:xrt|<00>D] \}}x|D]}||fVq"WqWnDxBt|<00>D]6\}}t|t<04>rpx"|D]}||fVq\WqD||fVqDWdS)z<>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)r=rr r<00>list)<04>datarHrErIr4r4r5<00>
_iter_data<EFBFBD>s



rtc@s<>eZdZdZdZdZeZddlZe ej
<EFBFBD>Z [dId
d <0B>Z e d d <0A><00>Zdd<0F>Ze dd<11><00>Zedd<13><00>Zejdd<13><00>Zdd<16>Zdd<18>Zeeedd<1A>Z[[dd<1C>Zdd<1E>Zdd <20>Zd!d"<22>Zeeed#d<1A>Zeed$d<1A>Z[[[d%d&<26>Zeeed'd<1A>Z[[d(d)<29>Zed*e d+d<1A>Z!ed,e"d-d<1A>Z#[d.d/<2F>Z$d0d1<64>Z%ee$e%d2d<1A>Z&[$[%d3d4<64>Z'd5d6<64>Z(ee'e(d7d<1A>Z)['[(d8d9<64>Z*d:d;<3B>Z+ee*e+d<d<1A>Z,[*[+ed=d><3E><00>Z-ed?d@<40><00>Z.dAdB<64>Z/dCdD<64>Z0dEdF<64>Z1dJdGdH<64>Z2dS)K<>EnvironBuildera<72>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`.
zHTTP/1.1)rrrN<>/<2F>GETF<54>utf-8cCsLt|<01>}|dk r$|d<01>|kr$td<02><01>|dkrL|d<01>|krL|<01>|d<01>d<03>\}}||_t|<01>|_|dk rttt||<10>|<10>}||_t|t t
f<02>r<>||_ n(|dkr<>t <0C>}nt|t <0C>s<>t |<03>}||_ ||_| dkr<>t<0F>} nt| t<0F>s<>t| <0C>} | |_|dk r<>||_|dk<08>rtj}||_| |_|
|_| |_||_||_||_||_d|_|dk <09>rr| dk <09>rVtd<05><01>|<00>|<12>} |jdk<08>rrd|_| <0A>r8|dk <09>r<>td<07><01>t| d<08><02>r<>| <0A> <20>} t| t
<EFBFBD><02>r<>| <0A>!|j<03>} t| t <09><02>r<>t"| <0A>|_|jdk<08>r8t#| <0A>|_nTxRt$| <0A>D]F\}}t|t%t&f<02><02>st|d<08><02>r |<00>'||<15>n|j(<28>)|<14><01>*|<15><00>q<>W|dk <09>rH||_+dS) N<>?z6Query string is defined in the path and as an argumentrFz can't provide both json and datazapplication/jsonz#can't provide input stream and datar9),r <00>
ValueError<EFBFBD>splitr8r<00>pathr<00>base_urlr=<00>bytesr<00> query_stringr<00>args<67>methodrrVr<<00>sys<79>stderr<72> errors_stream<61> multithread<61> multiprocess<73>run_once<63> environ_base<73>environ_overrides<65> input_stream<61>content_length<74>closed<65> TypeError<6F>
json_dumps<EFBFBD>hasattrr9r7rr,rt<00>tuple<6C>dict<63>_add_file_from_data<74>formZsetlistdefaultrZrS)rWr|r}rr<>r<>r<r<>r<>r<>r<>r<>rVrsr<>r<>r8rS<00>jsonZpath_srHrIr4r4r5rXTsv






 
    
  
zEnvironBuilder.__init__c Ks<>tt|<01><01>}|d|<00>|d|<03>d<03>|d<00>|d|d|d|<03>dd <09>|<03>d
d <09>|d |d |d |d|d<0F> }|<04>|<02>|f|<04>S)z<>Turn an environ dict back into a builder. Any extra kwargs
override the args extracted from the environ.
.. versionadded:: 0.15
<20> PATH_INFOzwsgi.url_scheme<6D>Host<73> SCRIPT_NAME<4D> QUERY_STRING<4E>REQUEST_METHODz
wsgi.inputz Content-TypeNzContent-Lengthz wsgi.errorszwsgi.multithreadzwsgi.multiprocessz wsgi.run_once) r|r}rr<>r<>r<r<>r<>r<>r<>r<>rV)rr<00>_make_base_urlrl<00>update)<05>clsrm<00>kwargsrV<00>outr4r4r5<00> from_environ<6F>s  


zEnvironBuilder.from_environcCs<>t|t<01>r|jj|f|<02><02>nht|t<04>rxddlm}|dtdd<05>t|<02>}|<02>dd<07>}|dk rf||d<|jj|f|<02>n|j<02>||<02>dS) z=Called in the EnvironBuilder to add files from the data dict.r)rNz<>Passing a dict as file data is deprecated as of version 0.5 and will be removed in version 1.0. Use a tuple or 'FileStorage' object instead.r*)rOrSNr<) r=r<><00>filesZadd_filer<65>rPrNrQrl)rWrHrIrNrSr4r4r5r<><00>s

  z"EnvironBuilder._add_file_from_datacCst|||ddf<05><01>d<02>dS)N<>rv)r <00>rstrip)<03>scheme<6D>host<73> script_rootr4r4r5r<><00>szEnvironBuilder._make_base_urlcCs|<00>|j|j|j<03>S)z`The base URL is used to extract the URL scheme, host name,
port, and root path.
)r<><00>
url_schemer<EFBFBD>r<>)rWr4r4r5r}<00>szEnvironBuilder.base_urlcCsT|dkrd}d}d}n"t|<01>\}}}}}|s0|r8td<04><01>|<04>d<05>|_||_||_dS)N<>http<74> localhostr<74>z4base url must not contain a query string or fragmentrv)rrzr<>r<>r<>r<>)rWrIr<><00>netlocr<63><00>qs<71>anchorr4r4r5r}<00>s cCs6|j<00>d<01>}|dkr2|js2|jr$dS|jr.dSdS|S)Nz Content-Typezmultipart/form-dataz!application/x-www-form-urlencoded)rV<00>get<65> _input_stream<61>_files<65>_form)rW<00>ctr4r4r5<00>_get_content_type<70>s z EnvironBuilder._get_content_typecCs&|dkr|j<00>dd<00>n
||jd<dS)Nz Content-Type)rVrl)rWrIr4r4r5<00>_set_content_typesz EnvironBuilder._set_content_typez<65>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.)<01>doccCs|jjdtd<02>S)NzContent-Length)<01>type)rVr<>rB)rWr4r4r5<00>_get_content_lengthsz"EnvironBuilder._get_content_lengthcCs |j}|r|<01>d<01>d<00><02>SdS)N<>;r)r<r{<00>strip)rWr<>r4r4r5<00> _get_mimetypeszEnvironBuilder._get_mimetypecCst||j<01>|_dS)N)r"r8r<)rWrIr4r4r5<00> _set_mimetypeszEnvironBuilder._set_mimetypecs,<00>fdd<02>}t<00>j<01>dd<04><02>d}t||<01>S)Ncst<00>j|<00><02>jd<dS)Nz Content-Type)rrSrV)<01>d)rWr4r5<00> on_updatesz6EnvironBuilder._get_mimetype_params.<locals>.on_updatez content-typer<65>r)rrVr<>r)rWr<>r<>r4)rWr5<00>_get_mimetype_paramss z#EnvironBuilder._get_mimetype_paramszUThe mimetype (content type without charset etc.)
.. versionadded:: 0.14
z<> 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
cCs*|dkr|j<00>dd<00>nt|<01>|jd<dS)NzContent-Length)rVrlrA)rWrIr4r4r5<00>_set_content_length5sz"EnvironBuilder._set_content_lengthz<68>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.cs0d|<00><00><00>fdd<03>}<03>fdd<05>}t|||d<06>S)N<>_cs:|jdk rtd<01><01>t|<00><00>}|dkr6<72><01>}t|<00>|<01>|S)Nzan input stream is defined)r<><00>AttributeErrorr><00>setattr)rWr_)rH<00>storager4r5<00>getterGs

 z,EnvironBuilder.form_property.<locals>.gettercsd|_t|<00>|<01>dS)N)r<>r<>)rWrI)rHr4r5<00>setterQsz,EnvironBuilder.form_property.<locals>.setter)r<>)<01>property)r;r<>r<>r<>r<>r4)rHr<>r5<00> form_propertyDs
zEnvironBuilder.form_propertyr<79>z$A :class:`MultiDict` of form values.r<>z<>A :class:`FileMultiDict` of uploaded files. You can use
the :meth:`~FileMultiDict.add_file` method to add new files to
the dict.cCs|jS)N)r<>)rWr4r4r5<00>_get_input_streamasz EnvironBuilder._get_input_streamcCs||_d|_|_dS)N)r<>r<>r<>)rWrIr4r4r5<00>_set_input_streamdsz EnvironBuilder._set_input_streamz`An optional input stream. If you set this it will clear
:attr:`form` and :attr:`files`.cCs.|jdkr(|jdk r$t|j|jd<01>SdS|jS)N)r8r<>)<04> _query_string<6E>_argsrr8)rWr4r4r5<00>_get_query_stringps


z EnvironBuilder._get_query_stringcCs||_d|_dS)N)r<>r<>)rWrIr4r4r5<00>_set_query_stringwsz EnvironBuilder._set_query_stringz`The query string. If you set this to a string
:attr:`args` will no longer be available.cCs*|jdk rtd<01><01>|jdkr$t<03>|_|jS)Nza query string is defined)r<>r<>r<>r)rWr4r4r5<00> _get_args<67>s


zEnvironBuilder._get_argscCsd|_||_dS)N)r<>r<>)rWrIr4r4r5<00> _set_args<67>szEnvironBuilder._set_argsz(The URL arguments as :class:`MultiDict`.cCs|j<00>dd<02>dS)z4The server name (read-only, use :attr:`host` to set)<29>:rr)r<>r{)rWr4r4r5<00> server_name<6D>szEnvironBuilder.server_namecCsD|j<00>dd<02>}t|<01>dkr2|d<00><03>r2t|d<00>S|jdkr@dSdS)z?The server port as integer (read-only, use :attr:`host` to set)r<>rr*<00>httpsi<73><00>P)r<>r{r,<00>isdigitrBr<>)rW<00>piecesr4r4r5<00> server_port<72>s  
zEnvironBuilder.server_portcCs&y |<00><00>Wntk
r YnXdS)N)<02>close<73> Exception)rWr4r4r5<00>__del__<5F>s zEnvironBuilder.__del__c Csl|jr
dSyt|j<02>}Wntk
r0d}YnXx.|D]&}y |<02><04>Wq8tk
r\Yq8Xq8Wd|_dS)z<>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.
Nr4T)r<>r
r<>r<>r<>r<>)rWr<><00>fr4r4r5r<><00>s

 
zEnvironBuilder.closecs<><00>j}<01>j}<02>j}<03>j}|dk rP|<01><04>}|<01>dd<03>|<01><04>}|<01>|<05>||}nt|dkr<>t<06>j<07>jg<02>}t |<07>j
d<05>\}}}|d|}n:|dkr<>t <0B>j<07>j
d<05>}|<07> d<08>}t |<07>}t|<07>}nt<0E>}i} <09>jr<>| <09><10>j<0F><00>fd d
<EFBFBD>}
t<11>j<12>} | <09><10>j|
<EFBFBD>j<14>|
<EFBFBD>j<15>| t<11>j<15>t<11>j<15><01>jt<17>j<18><01>j<19>j<1A>j<1B>j|<01>j<1D>j<1E>j<1F>j d <0B><11><00>j!<21>"<22>} |dk <09>rx|| d <| <0C>#d |<04>|dk <09>r<>t|<02>| d<| <0C>#d|<02>x.| <0C>$<24>D]"\} }|| d| <0A>%<25><00>&dd<12><<00>q<>W<00>j'<27>r<>| <09><10>j'<27>| S)z<>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.
Nrr*zmultipart/form-data)r8z; boundary="%s"z!application/x-www-form-urlencoded<65>asciicstt|<00>j<02><02>j<02>S)N)rr!r8)<01>x)rWr4r5<00> _path_encode<64>sz0EnvironBuilder.get_environ.<locals>._path_encode)r<>r<>r<>r<>Z REQUEST_URIZRAW_URIZ SERVER_NAMEZ SERVER_PORTZ HTTP_HOSTZSERVER_PROTOCOLz wsgi.versionzwsgi.url_schemez
wsgi.inputz wsgi.errorszwsgi.multithreadzwsgi.multiprocessz wsgi.run_once<63> CONTENT_TYPEz Content-Type<70>CONTENT_LENGTHzContent-LengthzHTTP_%s<>-r<>)(r<>r<>rSr<rCrDrr<>r<>rLr8rr7r,rr<>r<>rrr<>r<>r|r<>rAr<>r<><00>server_protocol<6F> wsgi_versionr<6E>r<>r<>r<>r<>rV<00>copy<70>setZ to_wsgi_list<73>upper<65>replacer<65>)rWr<>r<>rSr<Z start_posZend_posrErG<00>resultr<74>r<>rVrHrIr4)rWr5<00> get_environ<6F>sp 



  
 

 
   zEnvironBuilder.get_environcCs|dkr|j}||<00><01><00>S)z<>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)<02> request_classr<73>)rWr<>r4r4r5<00> get_requestszEnvironBuilder.get_request)rvNNrwNNNNFFFNNNNrxNN)N)3rarbrcrdr<>r<>r#r<>r<><00> staticmethod<6F>dumpsr<73>rX<00> classmethodr<64>r<>r<>r<>r}r<>r<>r<>r<r<>r<>r<>r<>rSZmimetype_paramsr<73>r<>r<>rr<>rr<>r<>r<>r<>r<>r<>rr<>r<>r<>r<>r<>r<>r<>r<>r<>r4r4r4r5ru<00>s<>M

F   
  
Vruc@seZdZdZdS)<03>ClientRedirectErrorzIf a redirect loop is detected when using follow_redirects=True with
the :cls:`Client`, then this exception is raised.
N)rarbrcrdr4r4r4r5r<>sr<>c@s<>eZdZdZd&dd<06>Zd'd
d <0B>Zd(d d <0A>Zd)dd<0F>Zd*dd<11>Zdd<13>Z dd<15>Z
dd<17>Z dd<19>Z dd<1B>Z dd<1D>Zdd<1F>Zd d!<21>Zd"d#<23>Zd$d%<25>ZdS)+<2B>Clienta<74>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.
NTFcCs*||_||_|rt<02>|_nd|_||_dS)N)<05> application<6F>response_wrapperrg<00>
cookie_jar<EFBFBD>allow_subdomain_redirects)rWr<>r<>Z use_cookiesr<73>r4r4r5rXBs 
zClient.__init__r<5F>rv<00>utf-8c 
CsV|jdk std<02><01>t|||||||| |
<EFBFBD> } t|d|d<04>} d| fg} |j<00>| | <0A>dS)z<>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.
Nzcookies disabledzhttp://)r}z
Set-Cookie)r<><00>AssertionErrorr<00>create_environrq)rWr<>rHrI<00>max_age<67>expiresr|<00>domain<69>secure<72>httponlyr8<00>headerrmrVr4r4r5<00>
set_cookieQs 
zClient.set_cookiecCs|j||dd||d<02>dS)z$Deletes a cookie in the test client.r)r<>r<>r|r<>N)r<>)rWr<>rHr|r<>r4r4r5<00> delete_cookiejszClient.delete_cookiecCsF|jdk r|j<00>|<01>t|j||d<02>}|jdk rB|j<00>||d<00>|S)z5Runs the wrapped WSGI app with the given environment.N)<01>bufferedr*)r<>rn<00> run_wsgi_appr<70>rq)rWrmr<>r_r4r4r5r<>ps 
 
zClient.run_wsgi_appcCs^t|<02>\}}}}} tj||d<01>}
|<06>dd<03>d<00>d<05>} |
j<04>d<05>} | dgkrZ||
_||
_n| } | | kr<>| t| <0C> d<07>| kr<>|js<>t d<08><01>nt d <09><01>|<07>d
<EFBFBD>} |
j
<EFBFBD>d
<EFBFBD>}| dt|<0E><01>|kr<>|t|
j
<EFBFBD>d<07>|
_ n ||
_ d|
_
t |d<00>dd<03>d<00>}|d k<07>r4|
j d k<03>rd |
_ d|
_d|
_d|
_|
j<11>dd<07>|j}d|_z|j|
d|d<10>S||_XdS)znPerform a new request to the location given by the redirect
response to the previous request.
)rr<>rr<00>.r<>Nz-Following subdomain redirects is not enabled.z.Following external redirects is not supported.rv><00>3<00>4<00>HEADrwzTransfer-EncodingT)<02>as_tupler<65>)rrur<>r{r<>r<>r<>r,r<><00> RuntimeErrorr<72>r|rBr<>r<>r<r<>rVrlr<><00>open)rW<00>response<73> new_locationrmr<>r<>r<>r|r<>r<><00>builderZ to_name_partsZfrom_name_parts<74>
path_partsZ
root_parts<EFBFBD> status_codeZold_response_wrapperr4r4r5<00>resolve_redirectys@ 


 
 zClient.resolve_redirectcOsZ|<02>dd<02>}|<02>dd<02>}|<02>dd<02>}d}|sjt|<01>dkrjt|dt<03>rT|d<00><04>}nt|dt<05>rj|d}|dkr<>t||<02>}z |<07><04>}Wd|<07><06>X|j|<06><08>|d<08>}g} x<>t |d<00>
dd<06>d<00>}
|
d ks<>|s<>P|s<>x|dD]} q<>W|d
d } | |
f} | | k<06>rt d <0C><01>| <09> | <0A>|j || ||d<08>\}}q<>W|jdk <09>rH|j|<08>}|<03>rV||fS|S) a<>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.
rFr<46><00>follow_redirectsNrr)r<>><00>-<00>.<00>/<00>1<00>3<00>4r*<00>locationz loop detected)rlr,r=rur<>r<>r<>r<>r<>rBr{r<>rZr r<>)rWr<>r<>rr<>r rmrrZredirect_chainr
r<>rZnew_redirect_entryr4r4r5r<00>sH   
 
 

 
z Client.opencOsd|d<|j||<02>S)z(Like open but method is enforced to GET.rwr<>)r)rWr<><00>kwr4r4r5r<>sz
Client.getcOsd|d<|j||<02>S)z*Like open but method is enforced to PATCH.<2E>PATCHr<48>)r)rWr<>rr4r4r5<00>patchsz Client.patchcOsd|d<|j||<02>S)z)Like open but method is enforced to POST.<2E>POSTr<54>)r)rWr<>rr4r4r5<00>post sz Client.postcOsd|d<|j||<02>S)z)Like open but method is enforced to HEAD.rr<>)r)rWr<>rr4r4r5<00>headsz Client.headcOsd|d<|j||<02>S)z(Like open but method is enforced to PUT.<2E>PUTr<54>)r)rWr<>rr4r4r5<00>putsz
Client.putcOsd|d<|j||<02>S)z+Like open but method is enforced to DELETE.<2E>DELETEr<45>)r)rWr<>rr4r4r5<00>deletesz Client.deletecOsd|d<|j||<02>S)z,Like open but method is enforced to OPTIONS.<2E>OPTIONSr<53>)r)rWr<>rr4r4r5<00>options szClient.optionscOsd|d<|j||<02>S)z*Like open but method is enforced to TRACE.<2E>TRACEr<45>)r)rWr<>rr4r4r5<00>trace%sz Client.tracecCsd|jj|jfS)Nz<%s %r>)<03> __class__rar<>)rWr4r4r5<00>__repr__*szClient.__repr__)NTF)r<>NNrvNNFr<46>)rvN)F)F)rarbrcrdrXr<>r<>r<>r rr<>rrrrrrr!r#r4r4r4r5r<>!s2



?Jr<>cOs"t||<01>}z|<02><01>S|<02><02>XdS)a<>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)rur<>r<>)r<>r<>rr4r4r5r<>.s
r<>Fcs<>t|<01>}g<00>g<00>d<07><00>fdd<03> }|||<03>}t|dd<01>}t|<04>}|rbz t|<06>}Wd|dk r^|<05>XnFx|D]}<07><00>|<07><00>rhPqhW<00>r<>t<05>|<06>}|dk r<>||k r<>t||<05>}|<06>dt<07>d<00>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)``
Ncs&|dk rt|<02>||g<02>dd<00><<00>jS)N)r rZ)<03>statusrV<00>exc_info)<02>bufferrr4r5<00>start_responseYsz$run_wsgi_app.<locals>.start_responser<65>rr)N)rr><00>iterrrrZrr$r)Zapprmr<>r'Zapp_rvZ
close_funcZapp_iter<65>itemr4)r&rr5r<>Ds*
  




r<>)Tr(Nr))Nr))NN)F)Grdr?r<><00>ior<00> itertoolsrr<00>tempfilerr<00>_compatrr r
r r r rrr<00> _internalrZdatastructuresrrrrrrrr<>rrr<00>urlsrrrrr r!<00>utilsr"<00>wrappersr#Zwsgir$r%<00>urllib.requestr&rp<00> ImportError<6F>urllib2<62>http.cookiejarr'<00> cookielibrLrMrT<00>objectrUrergrtrur<>r<>r<>r<>r<>r4r4r4r5<00><module>
s~                                   
K
 )